Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Just can't fix the 65k issue

I've been at this for two days now. I tried all solutions related to multi-dexing and so but to no avail. I removed everything so that I can do a fresh start.

App gradle:

apply plugin: 'com.android.application'
android {
          compileSdkVersion 21
          buildToolsVersion "21.1.2"
          defaultConfig {
          applicationId "com.bilboldev.joestrategy"
          minSdkVersion 15
          targetSdkVersion 21
          versionCode 1
          versionName "1.0"
          multiDexEnabled true
      }
buildTypes {
    release {
        minifyEnabled false

        proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
      }
   }
}

dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services-ads:9.0.0'
}

apply plugin: 'com.google.gms.google-services'

Project gradle:

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.1.0'
    classpath 'com.google.gms:google-services:3.0.0'

}
}



allprojects {
repositories {
    jcenter()
}
}

Inside manifiest:

 <meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />
 <application
    android:name="android.support.multidex.MultiDexApplication" ...

The most common solution I read was don't include all google services, just the things you need. And thus i only compile the ads one. But it still doesn't work.

Some of the classes not being found:

E/dalvikvm﹕ Could not find class 'android.os.UserManager', referenced from method com.google.android.gms.common.zze.zzan

E/dalvikvm﹕ Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.internal.zzpv.zzg

E/dalvikvm﹕ Could not find class 'com.google.android.gms.internal.zzamq', referenced from method com.google.android.gms.internal.zzdi.zze

etc...

I tried all the approaches I found, one of which is this. I also used the dexcount plugin mentioned in the end to count the methods in my app. I don't know how to attach a file to a question so you can download the debug.txt from here.

Note: I believe that this is a 65k limit issue because on a 4.4 android mobile, the ads display and the errors do not show in logcat. but on two 4.2 android mobiles, the ads don't show and the errors how. HOWEVER, if you look at the debug.txt:

methods fields package/class name

15236 5010 android

14282 9575 com

Rest are less than 3k combined

I just don't see 65k... unless android and what's under it (android.something) stack

What am I missing here?

like image 584
Moussa Khalil Avatar asked Jun 02 '16 12:06

Moussa Khalil


1 Answers

Adding GMS you should have easily reached the 64K limit.

So let's look at the situation here:

  • You're below 64K methods when you probably should have been above.
  • You're missing classes.

Not having your full set of Gradle file, I would guess that the issue is related to Proguard cutting out stuff you want to keep. I suggest first turning off Proguard obfuscation entirely and testing whether this fixed the issue.

like image 103
Vaiden Avatar answered Oct 16 '22 01:10

Vaiden