“java.lang.NoClassDefFoundError: com.google.android.gms.R$string error” After adding “libs/mpandroidchartlibrary-2-1-6.jar”

后端 未结 4 1980
慢半拍i
慢半拍i 2021-01-07 03:52

eI found this error after adding compile files(\'libs/mpandroidchartlibrary-2-1-6.jar\'). It work properly before adding mpandroidchartlibrary-2-1-6.jar

FAT

相关标签:
4条回答
  • 2021-01-07 03:58

    ** Finally this work for me..

    ->Configuring Your App for Multidex with Gradle. http://developer.android.com/tools/building/multidex.html#mdex-gradle**

    1)Modify your manifest to reference the MultiDexApplication class

           android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"
    
        defaultConfig {
    
            minSdkVersion 14
            targetSdkVersion 21
    multiDexEnabled true
        }
    dependencies {
      compile 'com.android.support:multidex:1.0.0'
    }
    

    '}'

    **2) In your manifest add the MultiDexApplication class from the multidex support library to the application element.

    Add following line in the application tag of manifest file.**

    <application
    
            android:name="android.support.multidex.MultiDexApplication">
    
    0 讨论(0)
  • 2021-01-07 04:04

    In Manifest -> Application add below line

     android:name="android.support.multidex.MultiDexApplication"
    

    Note: If you have already any Application class just extend that application class with MultiDexApplication

    0 讨论(0)
  • 2021-01-07 04:04

    If the problem persists even after enabling multidex and everything make sure you have compiledSdkVersion compatible with the build tools...

    I am not sure but I had some app with this and the problem persisted:

    compileSdkVersion 25
    buildToolsVersion "26.0.2"
    

    It worked after changing to something like this:

    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    
    0 讨论(0)
  • 2021-01-07 04:12

    In app build.gradle file

    android {  
      defaultConfig { 
         multiDexEnabled true 
       }  
    }
    
    dependencies { 
       compile 'com.android.support:multidex:1.0.1'
    } 
    

    than in your Application class extends MultiDexApplication class

     public class myApplication extends MultiDexApplication {  
        @Override
        public void onCreate() {
           super.onCreate(); 
        }
     }
    

    than in your Manifest add myApplication class

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.demo.application">
    <application
        ....
        android:name=".myApplication">
        ....
    </application>
    

    0 讨论(0)
提交回复
热议问题