Play Services implementation of GCM will not run in emulator (part 2)

189 views
Skip to first unread message

Kenneth Corbin

unread,
Apr 30, 2015, 6:54:03 PM4/30/15
to andro...@googlegroups.com
The Play Services version of my app runs, but does not work properly on a 5.0 AVD.  I can work with that.  But it will not even install on a 2.3.3 AVD.  This may be a show stopper.  I am not ready to release a version of the app that does not support 2.3.3.  But then I don't know if this will work on a real 2.3.3 device or if this is another emulator issue.

The immediate failure is INSTALL_FAILED_DEXOPT.  The logcat logs are not quite clear as to what is going wrong, but the key stuff seems to be
04-30 10:00:12.268 D/installd(   34): DexInv: --- BEGIN '/data/app/net.anei.cadpage-1.apk' ---
04-30 10:00:14.259 D/dalvikvm(  351): Note: class Lcom/google/android/gms/games/internal/IGamesService$Stub; has 202 unimplemented (abstract) methods
04-30 10:00:14.609 D/dalvikvm(  351): DexOpt: couldn't find field Landroid/app/Notification;.actions
04-30 10:00:14.659 D/dalvikvm(  351): DexOpt: couldn't find static field
04-30 10:00:14.659 D/dalvikvm(  351): DexOpt: couldn't find field Landroid/graphics/BitmapFactory$Options;.inMutable
04-30 10:00:14.919 E/dalvikvm(  351): LinearAlloc exceeded capacity (5242880), last=344
04-30 10:00:14.919 E/dalvikvm(  351): VM aborting

The app is already pretty large and it is not unlikely that including the Play Services library pushed me over some hard limits.  The documentation has instructions for how to compile a limited subset of the Play Services library, but only for Android Studio and I am still using Eclipse w/ADT.  I have been searching, unsucessfully, for instructions on doing the partial compile trick with Eclipse.  Next week I can try porting everything to Android  Studio, but for right now I and stuck.

Kenneth Corbin

unread,
May 16, 2015, 10:29:09 PM5/16/15
to andro...@googlegroups.com
Porting the app to Android Studio has proven to be difficult for a number of reasons.  I haven't given up on it yet, but there is a lot more work to do.

I did, however, figure out how to include partial Play Services libraries in an Eclipse project.  And the app built with those partial libraries does install successfully on a 2.3.3 emulator.  Whether or not it will work on real devices remains to be seen.  But as long as it installs, I can always use the fallback logic if something goes seriously wrong with the new play services GCM logic.

Just in case someone else runs into this, here is what you have to do to include the play service GCM libraries in an Eclipse project.

* You will actually need to install two library projects google-play-services-gcm and google-play-services-base.  Both can be found in the Maven repository included in one of the the Extras SDK modules.  I can not positively identify which one, the ones I have installed are
Android Support Repository, Android Support Library, Google Play services, and Google Repository.  
The last one is the most likely candidate.

* Once this is done, the necessary libraries can be found under
  <android-sdks>/extras/google/m2repository/com/google/android/gms
  as play-services-gcm/7.3.0/play-services-gcm-7.3.0.pom
  and play-services-base/7.3.0/play-services-base-7.3.0.pom
  Obviously the version numbers may change as new versions are released by Google

* Both pom files are really zip files that need to be unzipped into new folders in your Eclipse workspace.

* The actual library file is the classes.jar file, but it does not work where it is.  You have to create a "libs" subfolder and move classes.jar into that folder.  Renaming it to something more appropriate would also be a good idea.

Import both library project into your Eclipse workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import them.  Also open the project properties dialog, select the Android    tab, and check the "Is Library" box.

* In your main project app, open project properties, select the Android tab, click the "Add Library" button, and add the two new Android library projects

* If you have not already done so,  open your app's manifest file and add the following tag as a child of the <application> element:
  1. <meta-data android:name="com.google.android.gms.version"
           
    android:value="@integer/google_play_services_version" />
       
That should do it.

Pavel Repkin

unread,
Jul 8, 2015, 11:09:08 AM7/8/15
to andro...@googlegroups.com
I've spent hours googling to find out why our app has stopped working on 2.3 devices with INSTALL_FAILED_DEXOPT.
Until I found your guide.
Works like a charm.
Kenneth, thank you so much!

Reply all
Reply to author
Forward
0 new messages