Skip to main content
Participant
July 22, 2014
Answered

Adobe AIR ANE Android NoClasseDefFoundError

  • July 22, 2014
  • 1 reply
  • 2555 views

I am developing an ane for using and enjoying the service games google play.
I made a test app natively and runs perfectly.
I generated one ane and made a falsh builder for test. By utilizing it happens the following error:


07-22 15:55:35.555: E/AndroidRuntime(9983): FATAL EXCEPTION: main

07-22 15:55:35.555: E/AndroidRuntime(9983): java.lang.NoClassDefFoundError: com.google.example.games.basegameutils.GameHelper

07-22 15:55:35.555: E/AndroidRuntime(9983):     at com.google.example.games.basegameutils.BaseGameActivity.getGameHelper(BaseGameActivity.java:93)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at com.google.example.games.basegameutils.BaseGameActivity.onCreate(BaseGameActivity.java:103)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at com.google.example.games.tanc.MainActivity.onCreate(MainActivity.java:70)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at android.app.Activity.performCreate(Activity.java:5248)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at android.app.ActivityThread.access$800(ActivityThread.java:139)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at android.os.Handler.dispatchMessage(Handler.java:102)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at android.os.Looper.loop(Looper.java:136)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at android.app.ActivityThread.main(ActivityThread.java:5086)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at java.lang.reflect.Method.invokeNative(Native Method)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at java.lang.reflect.Method.invoke(Method.java:515)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)

07-22 15:55:35.555: E/AndroidRuntime(9983):     at dalvik.system.NativeStart.main(Native Method)

I looked in the package and the class it appears. I found the following solution, but does not work.
NoClassDefFoundError for code in an Java library on Android - Stack Overflow
"

  1. Go to "Properties" of the project.
  2. Select "Java Build Path"
  3. Select "Order and Export" Tab
  4. You should see the selected project's "src" and "gen" paths and dependencies here.
  5. The order how they listed were first "src" and then "gen" path
  6. I switch them, so that "gen" folder is build before the "src"

"

Thank you

This topic has been closed for replies.
Correct answer Eric Recluse

Hi guys,

   I just got same issues the other day, and I make it work now. I think it has nothing to do with the Proguard, you have to downgrade your google-play-services lib. 

   I upgraded my google-play-services to the latest version days before, and I found that if I chose the jdk 1.7 to compile my own ANE sources, neither my own java package, nor the google-play-services included in the final APK.

   But after I chose the jdk 1.6 to compile my sources and rebuilt the ANE, my own java package included in the final APK.  So I think the AIR adt doesn't support the classes that generated by jdk 1.7. Then I downloaded the 4.4.52 version google-play-services lib and rebuilt my ANE, everything works fine.

   Here is a link to the previous version of google-play-services lib: AdviewSDK_Android/google-play-services.jar at master · adview/AdviewSDK_Android · GitHub  .


   Hope this would help.

1 reply

alex_freshplanet
Participant
July 23, 2014

I think I have the same issue, though the error I get is not literally the same:

I/dalvikvm( 4979): Could not find method com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo, referenced from method com.freshplanet.ane.AirDeviceId.functions.getIDFAFunction.call

W/dalvikvm( 4979): VFY: unable to resolve static method 3164: Lcom/google/android/gms/ads/identifier/AdvertisingIdClient;.getAdvertisingIdInfo (Landroid/content/Context;)Lcom/google/android/gms/ads/identifier/AdvertisingIdClient$Info;

As far as I can tell, the problem is that most classes from the Google Play Services SDK are not included in the APK when packaging the application.

If I unzip my ANE binaries and inspect the jar files it contains, I can see everything is there.

But if I unzip the APK and run classes.dex through dexdump, the only Google classes I have are the following:

'Lcom/google/android/gms/internal/a;'

'Lcom/google/android/gms/internal/b;'

'Lcom/google/android/gms/internal/n;'

'Lcom/google/android/gms/internal/e;'

'Lcom/google/android/gms/internal/f$1;'

'Lcom/google/android/gms/internal/f$a;'

'Lcom/google/android/gms/internal/f$b;'

'Lcom/google/android/gms/internal/f$c;'

'Lcom/google/android/gms/internal/f$d;'

'Lcom/google/android/gms/internal/f$e;'

'Lcom/google/android/gms/internal/f$f;'

'Lcom/google/android/gms/internal/f$g;'

'Lcom/google/android/gms/internal/f$h;'

'Lcom/google/android/gms/internal/f$i;'

'Lcom/google/android/gms/internal/f$j;'

'Lcom/google/android/gms/internal/f$k;'

'Lcom/google/android/gms/internal/f$l;'

'Lcom/google/android/gms/internal/f$m;'

'Lcom/google/android/gms/internal/f;'

'Lcom/google/android/gms/internal/g;'

'Lcom/google/android/gms/internal/h;'

'Lcom/google/android/gms/internal/i;'

'Lcom/google/android/gms/internal/j$a;'

'Lcom/google/android/gms/internal/j;'

'Lcom/google/android/gms/internal/k$a;'

'Lcom/google/android/gms/internal/k;'

'Lcom/google/android/gms/internal/l;'

'Lcom/google/android/gms/internal/ly;'

'Lcom/google/android/gms/internal/m;'

'Lcom/google/android/gms/internal/o;'

'Lcom/google/android/gms/internal/p$a;'

'Lcom/google/android/gms/internal/p;'

'Lcom/google/android/gms/internal/q;'

'Lcom/google/android/gms/internal/r;'

In the Google Play Services documentation (Setting Up Google Play Services | Android Developers), they recommend adding a Proguard exception to "prevent ProGuard from stripping away required classes". That sounds related to our issue, but I have no idea where that exception would go and I don't even know if/how AIR uses Proguard (couldn't find any reference to it in the AIR SDK nor in the code of adt.jar).

If someone from Adobe could help us figure out why most of the Google Play classes are being stripped away when packaging the APK with ADT, that would be very helpful. The situation is somewhat urgent as Google will stop accepting apps that rely on the Android ID rather than the Advertiser ID at the end of the month.

Have a great day!

Alex @ FreshPlanet

Participant
July 23, 2014

Hello, Alex
I'm just creating an ANE to use the new service from Google Play Service

My real problem is this:
I caught the ANE https://github.com/freshplanet/ANE-Google-Play-Game-Services. using google play service in froyo version. And use another ANE AdMob using the latest version of google play service.

By using and enjoying the two together in my project I have problem as there are conflicting library because I have two different versions of google play service, got the idea to update the ANE https://github.com/freshplanet/ANE-Google-Play- Game-Services. And put the dependencies google service only play one of them.
ANE that started my whole problem was updating.

I had this same error in native application (Android) and was simple to solve. I changed the "build path -> Order and Export" order of packets by placing the "gen" in primero and the "src" soon followed. But this change does not fit when I expoprto the jar to generate ANE.

I ended up finding another that NEDs use google play latest service
https://github.com/alextel69/google-play-game-services-ane.

I saw in the documentation that it is using AIR SDK 4.0 and I'm using the AIR 3.6 SDK. I'll update my version and find out if that resolves the problem.

Which version of AIR SDK are you using?

Once I have news we report here

Thanks for your help.

Have a great day

Participant
July 23, 2014
I updated everything and the error persists.