This occurs when you are trying to access a file that does not exist in system.ResourceDirectory. If you change to system.DocumentsDirectory, the crash won’t occur.
I’m running 3459 and the ResourceDirectory example I posted results in a runtime error: “bad argument #1 to ‘open’ (string expected, got nil)”.
I’ve just been using the following method to prevent the issue.
local path = system.pathForFile( "ThisFileDoesntExist.json", system.ResourceDirectory ) local file, errorString if path then file, errorString = io.open( path, "r" ) end
To clarify, we’re using normal apks with expansion files, not android bundles. Our app is larger than 200MB so we’re dependant on expansion files.
We’re building all apps (android and iOS) on a Mac, if that makes any difference.
I’m trying to load files, that are packed to the android expansion files (obb files). In this case, color descriptors and localization files. Preventing the crash would not help, as the files are required for the app to function.
This has worked in the past!
2019.3476 - works
2019.3480 - works
2019.3486 - Build Error 11
2019.3487 - Build Error 11
2019.3490 - Build Error 11
2019.3502 - does not work
2019.3504 - does not work
2019.3508 - does not work
I also retested, if 2019.3508 works, if I set usesExpansionFile to false. Yes, it does. The problem only happens, if an expansion file is created!
I stripped our problem down to an example project and attached it to this post. I just uploaded the build of that project to a testapp on google: It shows the same crash. Hope that helps fixing the problem.
There still seems to be problems with this on Android 9. I got send the following Crashlog:
--------- beginning of crash FATAL EXCEPTION: background thread Process: com.XXX, PID: 26682 java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/utils/URLEncodedUtils; at com.google.android.vending.licensing.Policy.decodeExtras(Policy.java:183) at com.google.android.vending.licensing.APKExpansionPolicy.processServerResponse(APKExpansionPolicy.java:139) at com.google.android.vending.licensing.LicenseValidator.handleResponse(LicenseValidator.java:203) at com.google.android.vending.licensing.LicenseValidator.verify(LicenseValidator.java:163) at com.google.android.vending.licensing.LicenseChecker$ResultListener$2.run(LicenseChecker.java:229) at android.os.Handler.handleCallback(Handler.java:907) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:216) at android.os.HandlerThread.run(HandlerThread.java:65) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.client.utils.URLEncodedUtils" on path: DexPathList[[zip file "/data/app/com.XXX-8HOybYupzcltEQStmlofaA==/base.apk"],nativeLibraryDirectories=[/data/app/com.XXX-8HOybYupzcltEQStmlofaA==/lib/arm64, /data/app/com.XXX-8HOybYupzcltEQStmlofaA==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
This occurs when you are trying to access a file that does not exist in system.ResourceDirectory. If you change to system.DocumentsDirectory, the crash won’t occur.
I’m running 3459 and the ResourceDirectory example I posted results in a runtime error: “bad argument #1 to ‘open’ (string expected, got nil)”.
I’ve just been using the following method to prevent the issue.
local path = system.pathForFile( "ThisFileDoesntExist.json", system.ResourceDirectory ) local file, errorString if path then file, errorString = io.open( path, "r" ) end
To clarify, we’re using normal apks with expansion files, not android bundles. Our app is larger than 200MB so we’re dependant on expansion files.
We’re building all apps (android and iOS) on a Mac, if that makes any difference.
I’m trying to load files, that are packed to the android expansion files (obb files). In this case, color descriptors and localization files. Preventing the crash would not help, as the files are required for the app to function.
This has worked in the past!
2019.3476 - works
2019.3480 - works
2019.3486 - Build Error 11
2019.3487 - Build Error 11
2019.3490 - Build Error 11
2019.3502 - does not work
2019.3504 - does not work
2019.3508 - does not work
I also retested, if 2019.3508 works, if I set usesExpansionFile to false. Yes, it does. The problem only happens, if an expansion file is created!
I stripped our problem down to an example project and attached it to this post. I just uploaded the build of that project to a testapp on google: It shows the same crash. Hope that helps fixing the problem.
There still seems to be problems with this on Android 9. I got send the following Crashlog:
--------- beginning of crash FATAL EXCEPTION: background thread Process: com.XXX, PID: 26682 java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/utils/URLEncodedUtils; at com.google.android.vending.licensing.Policy.decodeExtras(Policy.java:183) at com.google.android.vending.licensing.APKExpansionPolicy.processServerResponse(APKExpansionPolicy.java:139) at com.google.android.vending.licensing.LicenseValidator.handleResponse(LicenseValidator.java:203) at com.google.android.vending.licensing.LicenseValidator.verify(LicenseValidator.java:163) at com.google.android.vending.licensing.LicenseChecker$ResultListener$2.run(LicenseChecker.java:229) at android.os.Handler.handleCallback(Handler.java:907) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:216) at android.os.HandlerThread.run(HandlerThread.java:65) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.client.utils.URLEncodedUtils" on path: DexPathList[[zip file "/data/app/com.XXX-8HOybYupzcltEQStmlofaA==/base.apk"],nativeLibraryDirectories=[/data/app/com.XXX-8HOybYupzcltEQStmlofaA==/lib/arm64, /data/app/com.XXX-8HOybYupzcltEQStmlofaA==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312)