Could not find com.android.support:multidex-instrumentation:27.1.1

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 19:53:11

问题


I followed the instructions on the https://developer.android.com/studio/build/multidex

Here is my error code. Execution failed for task ':app:lintVitalRelease'.

Could not resolve all artifacts for configuration
':app:debugAndroidTestRuntimeClasspath'. Could not find com.android.support:multidex-instrumentation:27.1.1.

But i am geeting the same issue when trying the get signed apk here is the my dependicies:

defaultConfig {
    applicationId "com.myproject"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
    multiDexEnabled true
}

dependencies {
 implementation project(':react-native-date-picker')
 implementation project(':react-native-wheel-picker-android')
 implementation project(':lottie-react-native')
 implementation project(':react-native-firebase')
 implementation "com.google.firebase:firebase-auth:16.0.5"  
 implementation "com.google.android.gms:play-services-base:16.0.1"
 implementation "com.google.firebase:firebase-core:16.0.4"
 implementation 'com.android.support:multidex:1.0.3'
 implementation project(':react-native-svg')
 implementation fileTree(dir: "libs", include: ["*.jar"])
 implementation 'com.android.support:design:25.4.0'
 implementation "com.android.support:appcompat- 
 v7:${rootProject.ext.supportLibVersion}"
 implementation "com.facebook.react:react-native:+"  // From node_modules
 implementation project(':react-native-navigation')
 implementation project(':react-native-linear-gradient')

}

and My MainApplication.java:

public class MainApplication extends NavigationApplication {

  @Override
  protected void attachBaseContext(Context base) {
     super.attachBaseContext(base);
     MultiDex.install(this);
  }


  @Override
      public boolean isDebug() {
      return BuildConfig.DEBUG;
  }

   protected List<ReactPackage> getPackages() {
      // Add additional packages you require here
      // No need to add RnnPackage and MainReactPackage
      return Arrays.<ReactPackage>asList(
        new LinearGradientPackage(),
        new LottiePackage(),
        new RNFirebasePackage(),
        new RNFirebaseAuthPackage(),
        new WheelPickerPackage(),
        new DatePickerPackage()
      );

  }

  @Override
  public List<ReactPackage> createAdditionalReactPackages() {
      return getPackages();
  }

  @Override
  public String getJSMainModuleName() {
    return "index";
  }
}

thanks in advence


回答1:


Deleting this lines

@Override
  protected void attachBaseContext(Context base) {
     super.attachBaseContext(base);
     MultiDex.install(this);
  }

at MainApplication.java

 implementation 'com.android.support:multidex:1.0.3'

at build.gradle

and upgradeting minSdkVersion to 21 solved my problem




回答2:


React-native + rnn v2 got stuck with same problem sollution: If your minSdkVersion is set to 21 or higher, all you need to do is set multiDexEnabled to true in your module-level build.gradle file, as shown here:

android { defaultConfig { ... minSdkVersion 21 targetSdkVersion 28 multiDexEnabled true } ... }

However, if your minSdkVersion is set to 20 or lower, then you must use the multidex support library as follows: then follow the official instructions here https://developer.android.com/studio/build/multidex



来源:https://stackoverflow.com/questions/53802172/could-not-find-com-android-supportmultidex-instrumentation27-1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!