Skip to content

Commit 55bfe58

Browse files
committed
Use new library export handling
1 parent fa1441b commit 55bfe58

File tree

1 file changed

+58
-38
lines changed

1 file changed

+58
-38
lines changed

mode/src/processing/mode/android/AndroidBuild.java

+58-38
Original file line numberDiff line numberDiff line change
@@ -861,47 +861,67 @@ private void copyImportedLibs(final File libsFolder,
861861
final File assetsFolder) throws IOException {
862862
for (Library library : getImportedLibraries()) {
863863
// Add each item from the library folder / export list to the output
864-
for (File exportFile : library.getAndroidExports()) {
865-
String exportName = exportFile.getName();
864+
for (File exportFile : library.getApplicationExports("armeabi")) {
865+
copyImportedLib(libsFolder, mainFolder, assetsFolder, exportFile);
866+
}
867+
for (File exportFile : library.getApplicationExports("armeabi-v7a")) {
868+
copyImportedLib(libsFolder, mainFolder, assetsFolder, exportFile);
869+
}
870+
for (File exportFile : library.getApplicationExports("x86")) {
871+
copyImportedLib(libsFolder, mainFolder, assetsFolder, exportFile);
872+
}
873+
for (File exportFile : library.getApplicationExports("arm64-v8a")) {
874+
copyImportedLib(libsFolder, mainFolder, assetsFolder, exportFile);
875+
}
876+
for (File exportFile : library.getApplicationExports("x86_64")) {
877+
copyImportedLib(libsFolder, mainFolder, assetsFolder, exportFile);
878+
}
879+
}
880+
}
881+
882+
883+
private void copyImportedLib(final File libsFolder,
884+
final File mainFolder,
885+
final File assetsFolder,
886+
final File exportFile) throws IOException {
887+
String exportName = exportFile.getName();
866888

867-
// Skip the GVR and ARCore jars, because gradle will resolve the dependencies
868-
if (appComponent == VR && exportName.toLowerCase().startsWith("sdk")) continue;
869-
if (appComponent == AR && exportName.toLowerCase().startsWith("core")) continue;
870-
871-
if (!exportFile.exists()) {
872-
System.err.println(AndroidMode.getTextString("android_build.error.export_file_does_not_exist", exportFile.getName()));
873-
} else if (exportFile.isDirectory()) {
874-
// Copy native library folders to the correct location
875-
if (exportName.equals("armeabi") ||
876-
exportName.equals("armeabi-v7a") ||
877-
exportName.equals("x86") ||
878-
exportName.equals("arm64-v8a") ||
879-
exportName.equals("x86_64"))
880-
{
881-
Util.copyDir(exportFile, new File(libsFolder, exportName));
882-
}
883-
// Copy jni libraries (.so files) to the correct location
884-
else if (exportName.equals("jniLibs")) {
885-
Util.copyDir(exportFile, new File(mainFolder, exportName));
886-
}
887-
else {
888-
// Copy any other directory to the assets folder
889-
Util.copyDir(exportFile, new File(assetsFolder, exportName));
890-
}
891-
} else if (exportName.toLowerCase().endsWith(".zip")) {
892-
// As of r4 of the Android SDK, it looks like .zip files
893-
// are ignored in the libs folder, so rename to .jar
894-
System.err.println(AndroidMode.getTextString("android_build.error.zip_files_not_allowed", exportFile.getName()));
895-
String jarName = exportName.substring(0, exportName.length() - 4) + ".jar";
896-
Util.copyFile(exportFile, new File(libsFolder, jarName));
889+
// Skip the GVR and ARCore jars, because gradle will resolve the dependencies
890+
if (appComponent == VR && exportName.toLowerCase().startsWith("sdk")) return;
891+
if (appComponent == AR && exportName.toLowerCase().startsWith("core")) return;
892+
893+
if (!exportFile.exists()) {
894+
System.err.println(AndroidMode.getTextString("android_build.error.export_file_does_not_exist", exportFile.getName()));
895+
} else if (exportFile.isDirectory()) {
896+
// Copy native library folders to the correct location
897+
if (exportName.equals("armeabi") ||
898+
exportName.equals("armeabi-v7a") ||
899+
exportName.equals("x86") ||
900+
exportName.equals("arm64-v8a") ||
901+
exportName.equals("x86_64"))
902+
{
903+
Util.copyDir(exportFile, new File(libsFolder, exportName));
904+
}
905+
// Copy jni libraries (.so files) to the correct location
906+
else if (exportName.equals("jniLibs")) {
907+
Util.copyDir(exportFile, new File(mainFolder, exportName));
908+
}
909+
else {
910+
// Copy any other directory to the assets folder
911+
Util.copyDir(exportFile, new File(assetsFolder, exportName));
912+
}
913+
} else if (exportName.toLowerCase().endsWith(".zip")) {
914+
// As of r4 of the Android SDK, it looks like .zip files
915+
// are ignored in the libs folder, so rename to .jar
916+
System.err.println(AndroidMode.getTextString("android_build.error.zip_files_not_allowed", exportFile.getName()));
917+
String jarName = exportName.substring(0, exportName.length() - 4) + ".jar";
918+
Util.copyFile(exportFile, new File(libsFolder, jarName));
897919

898-
} else if (exportName.toLowerCase().endsWith(".jar")) {
899-
Util.copyFile(exportFile, new File(libsFolder, exportName));
920+
} else if (exportName.toLowerCase().endsWith(".jar")) {
921+
Util.copyFile(exportFile, new File(libsFolder, exportName));
900922

901-
} else {
902-
Util.copyFile(exportFile, new File(assetsFolder, exportName));
903-
}
904-
}
923+
} else {
924+
Util.copyFile(exportFile, new File(assetsFolder, exportName));
905925
}
906926
}
907927

0 commit comments

Comments
 (0)