Skip to content

Commit 2d2dd48

Browse files
authored
Android Updates v0.96.0 (#625)
* Android Template Updated * v0.96.0 * vs fix
1 parent 7a33faa commit 2d2dd48

File tree

9 files changed

+110
-187
lines changed

9 files changed

+110
-187
lines changed

commandLine/commandLine.vcxproj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,7 @@
264264
<ItemGroup>
265265
<ClCompile Include="src\main.cpp" />
266266
<ClCompile Include="src\addons\ofAddon.cpp" />
267-
<ClCompile Include="src\projects\androidStudioProject.cpp" />
268-
<ClCompile Include="src\projects\android2024.cpp" />
267+
<ClCompile Include="src\projects\android.cpp" />
269268
<ClCompile Include="src\projects\baseProject.cpp" />
270269
<ClCompile Include="src\projects\CBLinuxProject.cpp" />
271270
<ClCompile Include="src\projects\CBWinProject.cpp" />
@@ -280,8 +279,7 @@
280279
<ItemGroup>
281280
<ClInclude Include="src\optionparser.h" />
282281
<ClInclude Include="src\addons\ofAddon.h" />
283-
<ClInclude Include="src\projects\androidStudioProject.h" />
284-
<ClInclude Include="src\projects\android2024.h" />
282+
<ClInclude Include="src\projects\android.h" />
285283
<ClInclude Include="src\projects\baseProject.h" />
286284
<ClInclude Include="src\projects\CBLinuxProject.h" />
287285
<ClInclude Include="src\projects\CBWinProject.h" />
@@ -312,4 +310,4 @@
312310
<UserProperties RESOURCE_FILE="icon.rc" />
313311
</VisualStudio>
314312
</ProjectExtensions>
315-
</Project>
313+
</Project>

commandLine/commandLine.xcodeproj/project.pbxproj

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
03433CF32BF3B842001412CF /* android2024.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03433CF22BF3B842001412CF /* android2024.cpp */; };
10+
03433CF32BF3B842001412CF /* android.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03433CF22BF3B842001412CF /* android.cpp */; };
1111
03B57CDD2AC5B1C6005F56E0 /* VSCodeProject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03B57CDB2AC5B1C6005F56E0 /* VSCodeProject.cpp */; };
1212
"1A7D4C46-3FD3-4E35-9025-D0E93ECAD7DD" /* qtcreatorproject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = "C5A3016A-B663-4FE7-B6E6-421C5F168447" /* qtcreatorproject.cpp */; };
1313
"200CCA92-FAEE-4CEB-903B-ABB0D56B991F" /* ofAddon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = "41F34CBC-2E3E-4C3D-B106-F9D6746B6FF0" /* ofAddon.cpp */; };
1414
"2BC33EEF-CBDE-4E2E-9E0C-DB9AA6E0FE66" /* uuidxx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = "4CB92F80-3CD1-41B1-BD98-26F35C9C7A6E" /* uuidxx.cpp */; };
1515
"317CCC6B-35DE-4343-B4DC-3C797333928C" /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = "7F3C8ACE-56BA-44A0-B365-8499922F1F2C" /* Utils.cpp */; };
1616
"4E6F0A21-B0FF-4E2A-AACF-E1910A0DDE78" /* CBWinProject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = "D8A84D0F-1123-44F7-9D8D-79F8E2A0BFF4" /* CBWinProject.cpp */; };
1717
"653DA9D7-3254-4370-BF70-E18AF5925484" /* CBLinuxProject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = "546BDD51-ACDD-44C1-9C31-E1F3AD19A245" /* CBLinuxProject.cpp */; };
18-
"7F2BBCD1-F22D-454A-9100-33D1C12BEA70" /* androidStudioProject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = "FFD740F7-8E04-4563-A856-D4E402AF9C0E" /* androidStudioProject.cpp */; };
1918
"B07B8E19-F9DE-4E97-8833-859CD9267D30" /* LibraryBinary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = "1EFA4702-B4F3-4556-9C12-4FE21FD503D0" /* LibraryBinary.cpp */; };
2019
BF879F5D2C0F7CEB00200951 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF879F5C2C0F7CEB00200951 /* AVFoundation.framework */; };
2120
BF879F5F2C0F7ED500200951 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF879F5E2C0F7ED500200951 /* Foundation.framework */; };
@@ -50,8 +49,8 @@
5049
/* End PBXCopyFilesBuildPhase section */
5150

5251
/* Begin PBXFileReference section */
53-
03433CF12BF3B842001412CF /* android2024.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = android2024.h; sourceTree = "<group>"; };
54-
03433CF22BF3B842001412CF /* android2024.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = android2024.cpp; sourceTree = "<group>"; };
52+
03433CF12BF3B842001412CF /* android.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = android.h; sourceTree = "<group>"; };
53+
03433CF22BF3B842001412CF /* android.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = android.cpp; sourceTree = "<group>"; };
5554
03B57CDB2AC5B1C6005F56E0 /* VSCodeProject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VSCodeProject.cpp; sourceTree = "<group>"; };
5655
03B57CDC2AC5B1C6005F56E0 /* VSCodeProject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VSCodeProject.h; sourceTree = "<group>"; };
5756
"0C9DC8B7-7304-4A82-BAED-18F7A422ECA1" /* xcodeProject.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = xcodeProject.h; path = src/projects/xcodeProject.h; sourceTree = SOURCE_ROOT; };
@@ -70,7 +69,6 @@
7069
"52F09B38-455F-4FF2-8E8A-DCA504E2FE8D" /* baseProject.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = baseProject.h; path = src/projects/baseProject.h; sourceTree = SOURCE_ROOT; };
7170
"546BDD51-ACDD-44C1-9C31-E1F3AD19A245" /* CBLinuxProject.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; name = CBLinuxProject.cpp; path = src/projects/CBLinuxProject.cpp; sourceTree = SOURCE_ROOT; };
7271
"7BB75687-3F31-4D10-BE6A-C7918D1A678D" /* visualStudioProject.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; name = visualStudioProject.cpp; path = src/projects/visualStudioProject.cpp; sourceTree = SOURCE_ROOT; };
73-
"7D752B3A-9B2F-45F6-94D3-60D5A9600B13" /* androidStudioProject.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = androidStudioProject.h; path = src/projects/androidStudioProject.h; sourceTree = SOURCE_ROOT; };
7472
"7F3C8ACE-56BA-44A0-B365-8499922F1F2C" /* Utils.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; name = Utils.cpp; path = src/utils/Utils.cpp; sourceTree = SOURCE_ROOT; };
7573
"9314E210-0C9D-4025-9840-CD8122E2DC3D" /* LibraryBinary.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = LibraryBinary.h; path = src/utils/LibraryBinary.h; sourceTree = SOURCE_ROOT; };
7674
"9FAE80C7-5F2A-4E9D-9487-9E2667DE93DA" /* Utils.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = Utils.h; path = src/utils/Utils.h; sourceTree = SOURCE_ROOT; };
@@ -89,7 +87,6 @@
8987
E4B69E1F0A3A1BDC003C02F2 /* ofApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ofApp.h; path = src/ofApp.h; sourceTree = SOURCE_ROOT; };
9088
E4B6FCAD0C3E899E008CF71C /* openFrameworks-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "openFrameworks-Info.plist"; sourceTree = "<group>"; };
9189
E4EB6923138AFD0F00A09F29 /* Project.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Project.xcconfig; sourceTree = "<group>"; };
92-
"FFD740F7-8E04-4563-A856-D4E402AF9C0E" /* androidStudioProject.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; name = androidStudioProject.cpp; path = src/projects/androidStudioProject.cpp; sourceTree = SOURCE_ROOT; };
9390
/* End PBXFileReference section */
9491

9592
/* Begin PBXFrameworksBuildPhase section */
@@ -145,10 +142,8 @@
145142
"DDA07621-E95C-4267-B1B9-0127E0215328" /* CBLinuxProject.h */,
146143
"D8A84D0F-1123-44F7-9D8D-79F8E2A0BFF4" /* CBWinProject.cpp */,
147144
"1CFE3EC7-9370-47FF-A02D-1932663E6C10" /* CBWinProject.h */,
148-
03433CF22BF3B842001412CF /* android2024.cpp */,
149-
03433CF12BF3B842001412CF /* android2024.h */,
150-
"FFD740F7-8E04-4563-A856-D4E402AF9C0E" /* androidStudioProject.cpp */,
151-
"7D752B3A-9B2F-45F6-94D3-60D5A9600B13" /* androidStudioProject.h */,
145+
03433CF22BF3B842001412CF /* android.cpp */,
146+
03433CF12BF3B842001412CF /* android.h */,
152147
"247AA402-B7FD-4D0C-BB21-F3A90A35ADE7" /* baseProject.cpp */,
153148
"52F09B38-455F-4FF2-8E8A-DCA504E2FE8D" /* baseProject.h */,
154149
"C5A3016A-B663-4FE7-B6E6-421C5F168447" /* qtcreatorproject.cpp */,
@@ -352,10 +347,9 @@
352347
"200CCA92-FAEE-4CEB-903B-ABB0D56B991F" /* ofAddon.cpp in Sources */,
353348
"653DA9D7-3254-4370-BF70-E18AF5925484" /* CBLinuxProject.cpp in Sources */,
354349
"4E6F0A21-B0FF-4E2A-AACF-E1910A0DDE78" /* CBWinProject.cpp in Sources */,
355-
"7F2BBCD1-F22D-454A-9100-33D1C12BEA70" /* androidStudioProject.cpp in Sources */,
356350
"E79B31E1-CF27-4D77-B2F2-6AEC329A9F50" /* baseProject.cpp in Sources */,
357351
"1A7D4C46-3FD3-4E35-9025-D0E93ECAD7DD" /* qtcreatorproject.cpp in Sources */,
358-
03433CF32BF3B842001412CF /* android2024.cpp in Sources */,
352+
03433CF32BF3B842001412CF /* android.cpp in Sources */,
359353
"C2428661-BDEC-41D7-8150-C9BA5EE86C0C" /* visualStudioProject.cpp in Sources */,
360354
"DBD7E2AC-672A-4FD9-B0A4-DF24111D17FB" /* xcodeProject.cpp in Sources */,
361355
"B07B8E19-F9DE-4E97-8833-859CD9267D30" /* LibraryBinary.cpp in Sources */,

commandLine/src/defines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define OFPROJECTGENERATOR_MAJOR_VERSION "0"
2-
#define OFPROJECTGENERATOR_MINOR_VERSION "95"
2+
#define OFPROJECTGENERATOR_MINOR_VERSION "96"
33
#define OFPROJECTGENERATOR_PATCH_VERSION "0"
44

55
#define PG_VERSION (OFPROJECTGENERATOR_MAJOR_VERSION "." OFPROJECTGENERATOR_MINOR_VERSION "." OFPROJECTGENERATOR_PATCH_VERSION)
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#include "android.h"
2+
#include "ofLog.h"
3+
#include "Utils.h"
4+
#include "ofUtils.h"
5+
#include <regex>
6+
7+
std::string androidProject::LOG_NAME = "androidProject";
8+
9+
androidProject::androidProject(const std::string & target) : baseProject(target) {}
10+
11+
bool androidProject::createProjectFile(){
12+
13+
for (auto & f : vector<fs::path> {
14+
"build.gradle",
15+
"gradle",
16+
"gradle.properties",
17+
"local.properties",
18+
"ofApp/gradle.properties",
19+
"ofApp/proguard-rules.pro",
20+
"ofApp/src/AndroidManifest.xml",
21+
"ofApp/src/ic_launcher-playstore.png",
22+
"ofApp/src/CMakeLists.txt",
23+
"ofApp/src/main/main.txt",
24+
"ofApp/build.gradle",
25+
"src/ofApp.h",
26+
"src/ofApp.cpp",
27+
"src/main.cpp",
28+
"proguard.cfg",
29+
"settings.gradle",
30+
"template.config",
31+
}) {
32+
copyTemplateFiles.push_back({
33+
templatePath / f,
34+
projectDir / f
35+
});
36+
}
37+
copyTemplateFiles.push_back({
38+
templatePath / "ofApp" / "build.gradle",
39+
projectDir / "ofApp" / "build.gradle",
40+
{ { "emptyExample", projectName } }
41+
});
42+
for (auto & c : copyTemplateFiles) {
43+
c.run();
44+
}
45+
46+
try {
47+
fs::create_directories(projectDir / "ofApp");
48+
} catch (const std::exception & e) {
49+
ofLogError(LOG_NAME) << "Error creating directories: " << e.what();
50+
return false;
51+
}
52+
53+
// Copy the `src/` folder from the template
54+
try {
55+
fs::copy(
56+
templatePath / "ofApp" / "src",
57+
projectDir / "ofApp" / "src",
58+
fs::copy_options::recursive | (bOverwrite ? fs::copy_options::overwrite_existing : fs::copy_options::update_existing)
59+
);
60+
} catch (fs::filesystem_error & e) {
61+
ofLogError(LOG_NAME) << "Copy failed: " << e.what();
62+
return false;
63+
}
64+
65+
try {
66+
fs::copy(templatePath / "res", projectDir / "ofApp/res", fs::copy_options::recursive);
67+
} catch (fs::filesystem_error & e) {
68+
ofLogError(LOG_NAME) << "Error copying res folder: " << e.what();
69+
}
70+
71+
// Copy additional Android-specific template folders
72+
for (const auto & p : { "srcJava", "gradle" }) { // ✅ Removed "res" from this loop
73+
try {
74+
fs::copy(templatePath / p, projectDir / p, fs::copy_options::recursive);
75+
} catch (fs::filesystem_error & e) {
76+
ofLogError(LOG_NAME) << "Error copying " << p << ": " << e.what();
77+
}
78+
}
79+
80+
findandreplaceInTexfile(projectDir / "ofApp/res/values/strings.xml", "TEMPLATE_APP_NAME", projectName);
81+
fs::path from = projectDir / "srcJava/cc/openframeworks/APP_NAME";
82+
fs::path to = projectDir / ("srcJava/cc/openframeworks/" + projectName);
83+
84+
try {
85+
fs::create_directories(to.parent_path());
86+
fs::rename(from, to);
87+
} catch (const std::exception & e) {
88+
ofLogError(LOG_NAME) << "Error renaming package directory: " << e.what();
89+
}
90+
91+
findandreplaceInTexfile(to / "OFActivity.java", "TEMPLATE_APP_NAME", projectName);
92+
93+
ofLogNotice(LOG_NAME) << "Android Project created successfully!";
94+
return true;
95+
}

commandLine/src/projects/android2024.h renamed to commandLine/src/projects/android.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#include "baseProject.h"
44

5-
class android2024Project : public baseProject {
5+
class androidProject : public baseProject {
66
public:
7-
android2024Project(const std::string & target);
7+
androidProject(const std::string & target);
88

99
bool createProjectFile() override;
1010
void addInclude(const fs::path & includeName) override {}

commandLine/src/projects/android2024.cpp

Lines changed: 0 additions & 82 deletions
This file was deleted.

commandLine/src/projects/androidStudioProject.cpp

Lines changed: 0 additions & 55 deletions
This file was deleted.

commandLine/src/projects/androidStudioProject.h

Lines changed: 0 additions & 23 deletions
This file was deleted.

commandLine/src/utils/Utils.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
#include "Utils.h"
99
#include "ofUtils.h"
1010

11-
#include "android2024.h"
12-
#include "androidStudioProject.h"
11+
#include "android.h"
1312
#include "CBWinProject.h"
1413
#include "visualStudioProject.h"
1514
#include "VSCodeProject.h"
@@ -449,12 +448,9 @@ unique_ptr<baseProject> getTargetProject(const string & targ) {
449448
targ == "linuxaarch64"
450449
) {
451450
return unique_ptr<VSCodeProject>(new VSCodeProject(targ));
452-
}
453-
else if (targ == "android") {
454-
return unique_ptr<AndroidStudioProject>(new AndroidStudioProject(targ));
455451
}
456-
else if (targ == "android2024") {
457-
return unique_ptr<android2024Project>(new android2024Project(targ));
452+
else if (targ == "android") {
453+
return unique_ptr<androidProject>(new androidProject(targ));
458454
} else if (targ == "vscode") {
459455
return unique_ptr<VSCodeProject>(new VSCodeProject(targ));
460456
} else if (targ == "qtcreator") {

0 commit comments

Comments
 (0)