程序类型已经存在:带有React Native的android.support.v4.app.BackStackRecord $ Op

时间:2018-10-17 02:18:13

标签: android reactjs react-native android-studio-3.0

在我的React Native项目中安装react-native-maps后出现此错误。我不知道此错误的原因。我尝试了一切并进行搜索,发现了1个类似的问题,但尚未解决。所以我决定将其发布在这里,也许有人可以在这里解决此问题。

这是错误:

  

程序类型已存在:android.support.v4.app.BackStackRecord $ Op   消息{种类=错误,文本=程序类型已存在:android.support.v4.app.BackStackRecord $ Op,来源= [未知源文件],工具名称= Optional.of(D8)}

这是我的build.gradle(app):

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
    applicationId "com.practiceproject"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86"
    }
}
buildTypes {
    release {
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
        def versionCodes = ["armeabi-v7a":1, "x86":2]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
    }
}
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat- 
    v7:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:animated-vector-drawable:27.1.1"
    implementation "com.android.support:support-v4:24.0.0"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.android.support:appcompat-v7:23.0.3"
    implementation(project(':react-native-maps')){
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-maps'
   }
    implementation 'com.google.android.gms:play-services-base:10.0.1'
    implementation 'com.google.android.gms:play-services-maps:10.0.1'
    implementation "com.google.android.gms:play-services:10.0.1"
   }

  // Run this once to be able to run the application with BUCK
  // puts all compile dependencies into folder libs for BUCK to use
  task copyDownloadableDepsToLibs(type: Copy) {
     from configurations.compile
     into 'libs'
  }
  

实现“ com.android.support:appcompat-           v7:$ {rootProject.ext.supportLibVersion}“依赖项下的这一行用红线表示。这意味着它有问题。

这是我的build.gradle(项目):

buildscript {
ext {
    buildToolsVersion = "27.0.3"
    minSdkVersion = 16
    compileSdkVersion = 27
    targetSdkVersion = 27
    supportLibVersion = "27.1.1"
}
repositories {
    jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:4.0.1'
}
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is 
installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }
    google()
}
}


task wrapper(type: Wrapper) {
    gradleVersion = '4.4'
    distributionUrl = distributionUrl.replace("bin", "all")
}

0 个答案:

没有答案