Air 16.0 for Android - Unable to use native extension that include android-support-v4 - ClassNotFoundException
Hi there,
this is my first question here, and i really need help on this problem. We are struggling since few days on the following error: C
05-12 17:35:29.321: E/AndroidRuntime(26531): FATAL EXCEPTION: IntentService[MCGcmIntentService]
05-12 17:35:29.321: E/AndroidRuntime(26531): Process: air.com.mooncat.androidTest, PID: 26531
05-12 17:35:29.321: E/AndroidRuntime(26531): java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/NotificationCompat$Builder;
05-12 17:35:29.321: E/AndroidRuntime(26531): at com.mooncat.MCGooglePlayServices.MCGcmIntentService.sendNotification(MCGcmIntentService.java:92)
05-12 17:35:29.321: E/AndroidRuntime(26531): at com.mooncat.MCGooglePlayServices.MCGcmIntentService.onHandleIntent(MCGcmIntentService.java:48)
05-12 17:35:29.321: E/AndroidRuntime(26531): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
05-12 17:35:29.321: E/AndroidRuntime(26531): at android.os.Handler.dispatchMessage(Handler.java:102)
05-12 17:35:29.321: E/AndroidRuntime(26531): at android.os.Looper.loop(Looper.java:145)
05-12 17:35:29.321: E/AndroidRuntime(26531): at android.os.HandlerThread.run(HandlerThread.java:61)
05-12 17:35:29.321: E/AndroidRuntime(26531): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.app.NotificationCompat$Builder" on path: DexPathList[[zip file "/data/app/air.com.mooncat.androidTest-1/base.apk"],nativeLibraryDirectories=[/data/app/air.com.mooncat.androidTest-1/lib/arm, /vendor/lib, /system/lib]]
05-12 17:35:29.321: E/AndroidRuntime(26531): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
05-12 17:35:29.321: E/AndroidRuntime(26531): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-12 17:35:29.321: E/AndroidRuntime(26531): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
05-12 17:35:29.321: E/AndroidRuntime(26531): ... 6 more
05-12 17:35:29.321: E/AndroidRuntime(26531): Suppressed: java.lang.ClassNotFoundException: android.support.v4.app.NotificationCompat$Builder
05-12 17:35:29.321: E/AndroidRuntime(26531): at java.lang.Class.classForName(Native Method)
05-12 17:35:29.321: E/AndroidRuntime(26531): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
05-12 17:35:29.321: E/AndroidRuntime(26531): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
05-12 17:35:29.321: E/AndroidRuntime(26531): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
05-12 17:35:29.321: E/AndroidRuntime(26531): ... 7 more
05-12 17:35:29.321: E/AndroidRuntime(26531): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
My Native Extension use Google Play Services, and rely on the android support v4. The google play services functions works perfectly ( eg: i'm able to register the token through the google cloud functions ).
I saw this problem also in some other thread in github, and seems they solve it, but it doesn't fit my case. It's like if in the flash publication the android support v4 is 'removed'. I say this because i tried to decompile the generated apk, and i discovered that all the source exist ( like com/something/else, com/google/android/gms/..... ) BUT not the android/support/v4/.... . Instead, seems that the build apk contains only the android/support/v7/appcompat/R.java ( .java because is decompiled ). In the .ane file i have the android-support.v4.jar, and also the contained platform.xml at /META-INF/ANE/Android-ARM/. In the platform.xml i have this:
<?xml version="1.0" encoding="utf-8" ?>
<platform xmlns="http://ns.adobe.com/air/extension/4.0">
<packagedDependencies>
<packagedDependency>android-support-v4.jar</packagedDependency>
<packagedDependency>google-play-services.jar</packagedDependency>
</packagedDependencies>
<packagedResources>
<packagedResource>
<packageName>com.google.android.gms</packageName>
<folderName>google-play-services-res</folderName>
</packagedResource>
</packagedResources>
</platform>
In the eclipse project i tried to include the support-v4 library in all the possible ways, like dependency project, external jar, or kept as defult library in the libs folder. Nothing works...
I really can't figure out hot to solve this crazy problem.....
