@@ -74,9 +74,9 @@ class AndroidBuild extends JavaBuild {
74
74
// All of these are hard-coded, as the TARGET_SDK. Should obtained from the
75
75
// repository files? Or users being able to change them in the preferences
76
76
// file?
77
- static public final String SUPPORT_VER = "25.2.0 " ;
78
- static public final String PLAY_SERVICES_VER = "10.2 .0" ;
79
- static public final String WEAR_VER = "2.0.0 " ;
77
+ static public final String SUPPORT_VER = "25.3.1 " ;
78
+ static public final String PLAY_SERVICES_VER = "11.8 .0" ;
79
+ static public final String WEAR_VER = "2.0.5 " ;
80
80
static public final String GVR_VER = "1.60.1" ;
81
81
82
82
// Main activity or service
@@ -179,7 +179,7 @@ public boolean usesOpenGL() {
179
179
180
180
public String getPathForAPK () {
181
181
String suffix = target .equals ("release" ) ? "release_unsigned" : "debug" ;
182
- String apkName = module + "/build/outputs/apk/" + sketch .getName ().toLowerCase () + "_" + suffix + ".apk" ;
182
+ String apkName = getPathToAPK () + sketch .getName ().toLowerCase () + "_" + suffix + ".apk" ;
183
183
final File apkFile = new File (tmpFolder , apkName );
184
184
if (!apkFile .exists ()) {
185
185
return null ;
@@ -233,16 +233,12 @@ protected File createProject(boolean external)
233
233
File folder = sdk .getBuildToolsFolder ();
234
234
String [] versions = folder .list ();
235
235
String [] sorted = PApplet .sort (versions , versions .length );
236
- String buildToolsVer = "" ;
237
- if (sorted != null && 0 < sorted .length ) {
238
- buildToolsVer = sorted [sorted .length - 1 ];
239
- }
240
236
241
237
if (sketchClassName != null ) {
242
238
renderer = info .getRenderer ();
243
239
writeMainClass (srcFolder , renderer , external );
244
- createTopModule (buildToolsVer , "':" + module +"'" );
245
- createAppModule (buildToolsVer , module );
240
+ createTopModule ("':" + module +"'" );
241
+ createAppModule (module );
246
242
}
247
243
248
244
return tmpFolder ;
@@ -292,7 +288,7 @@ protected boolean gradleBuild() throws SketchException {
292
288
// Gradle modules
293
289
294
290
295
- private void createTopModule (String buildToolsVer , String projectModules )
291
+ private void createTopModule (String projectModules )
296
292
throws IOException {
297
293
File buildTemplate = mode .getContentFile ("templates/" + TOP_GRADLE_BUILD_TEMPLATE );
298
294
File buildlFile = new File (tmpFolder , "build.gradle" );
@@ -310,7 +306,7 @@ private void createTopModule(String buildToolsVer, String projectModules)
310
306
}
311
307
312
308
313
- private void createAppModule (String buildToolsVer , String moduleName )
309
+ private void createAppModule (String moduleName )
314
310
throws SketchException , IOException {
315
311
File moduleFolder = AndroidUtil .createPath (tmpFolder , moduleName );
316
312
@@ -332,7 +328,6 @@ private void createAppModule(String buildToolsVer, String moduleName)
332
328
HashMap <String , String > replaceMap = new HashMap <String , String >();
333
329
replaceMap .put ("@@tools_folder@@" , Base .getToolsFolder ().getPath ().replace ('\\' , '/' ));
334
330
replaceMap .put ("@@target_platform@@" , sdk .getTargetPlatform ().getPath ().replace ('\\' , '/' ));
335
- replaceMap .put ("@@build_tools@@" , buildToolsVer );
336
331
replaceMap .put ("@@package_name@@" , getPackageName ());
337
332
replaceMap .put ("@@min_sdk@@" , minSdk );
338
333
replaceMap .put ("@@target_sdk@@" , TARGET_SDK );
@@ -700,10 +695,6 @@ private void copySupportLibs(File tmpFolder, File libsFolder) throws IOException
700
695
aarFile = new File (sdk .getSupportLibrary (),
701
696
"/support-vector-drawable/" + SUPPORT_VER + "/support-vector-drawable-" + SUPPORT_VER + ".aar" );
702
697
Util .copyFile (aarFile , new File (libsFolder , aarFile .getName ()));
703
-
704
- File compatJarFile = new File (sdk .getSupportLibrary (),
705
- "/support-annotations/" + SUPPORT_VER + "/support-annotations-" + SUPPORT_VER + ".jar" );
706
- Util .copyFile (compatJarFile , new File (libsFolder , "support-annotations-" + SUPPORT_VER + ".jar" ));
707
698
}
708
699
709
700
@@ -758,7 +749,7 @@ public File exportPackage(String keyStorePassword) throws Exception {
758
749
759
750
// Final export folder
760
751
File exportFolder = createExportFolder ("build" );
761
- Util .copyDir (new File (projectFolder , module + "/build/outputs/apk" ), exportFolder );
752
+ Util .copyDir (new File (projectFolder , getPathToAPK () ), exportFolder );
762
753
return exportFolder ;
763
754
}
764
755
@@ -768,10 +759,10 @@ private File signPackage(File projectFolder, String keyStorePassword) throws Exc
768
759
if (keyStore == null ) return null ;
769
760
770
761
File unsignedPackage = new File (projectFolder ,
771
- module + "/build/outputs/apk/" + sketch .getName ().toLowerCase () + "_release_unsigned.apk" );
762
+ getPathToAPK () + sketch .getName ().toLowerCase () + "_release_unsigned.apk" );
772
763
if (!unsignedPackage .exists ()) return null ;
773
764
File signedPackage = new File (projectFolder ,
774
- module + "/build/outputs/apk/" + sketch .getName ().toLowerCase () + "_release_signed.apk" );
765
+ getPathToAPK () + sketch .getName ().toLowerCase () + "_release_signed.apk" );
775
766
776
767
JarSigner .signJar (unsignedPackage , signedPackage ,
777
768
AndroidKeyStore .ALIAS_STRING , keyStorePassword ,
@@ -793,7 +784,7 @@ private File zipalignPackage(File signedPackage, File projectFolder)
793
784
}
794
785
795
786
File alignedPackage = new File (projectFolder ,
796
- module + "/build/outputs/apk/" + sketch .getName ().toLowerCase () + "_release_signed_aligned.apk" );
787
+ getPathToAPK () + sketch .getName ().toLowerCase () + "_release_signed_aligned.apk" );
797
788
798
789
String [] args = {
799
790
zipAlign .getAbsolutePath (), "-v" , "-f" , "4" ,
@@ -906,18 +897,23 @@ private void copyCodeFolder(final File libsFolder) throws IOException {
906
897
907
898
private void renameAPK () {
908
899
String suffix = target .equals ("release" ) ? "release-unsigned" : "debug" ;
909
- String apkName = module + "/build/outputs/apk/" + module + "-" + suffix + ".apk" ;
900
+ String apkName = getPathToAPK () + module + "-" + suffix + ".apk" ;
910
901
final File apkFile = new File (tmpFolder , apkName );
911
902
if (apkFile .exists ()) {
912
903
String suffixNew = target .equals ("release" ) ? "release_unsigned" : "debug" ;
913
- String apkNameNew = module + "/build/outputs/apk/" +
904
+ String apkNameNew = getPathToAPK () +
914
905
sketch .getName ().toLowerCase () + "_" + suffixNew + ".apk" ;
915
906
final File apkFileNew = new File (tmpFolder , apkNameNew );
916
907
apkFile .renameTo (apkFileNew );
917
908
}
918
909
}
919
910
920
911
912
+ private String getPathToAPK () {
913
+ return module + "/build/outputs/apk/" + target + "/" ;
914
+ }
915
+
916
+
921
917
/**
922
918
* The Android dex util pukes on paths containing spaces, which will happen
923
919
* most of the time on Windows, since Processing sketches wind up in
0 commit comments