Android资源链接无法响应本机

时间:2019-10-15 08:07:11

标签: android react-native

我有一个React Native应用,当我输入react-native run-android命令时,出现以下错误。如果使用compileSdkVersion 28,它将显示:Program type already present: android.support.v4.app.INotificationSideChannel。然后,如果我使用compileSdkVersion 27,则会显示以下错误。这是错误:

enter image description here

这是我的android / gradle文件:

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 27
        targetSdkVersion = 26
        supportLibVersion = "27.1.1"
        multiDexEnabled = true
        googlePlayServicesVersion = "+" // default: "+"
        firebaseVersion = "+"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
}

allprojects {
    repositories {
        google()
        mavenLocal()
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency {
            details -> if (details.requested.group == 'com.android.support' && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.1.1"
            }
        }
    }
}
task wrapper(type: Wrapper) {
    gradleVersion = '4.4'
    distributionUrl = distributionUrl.replace("bin", "all")
}

这是我的app / gradle文件中的依赖项:

dependencies {
    implementation project(':react-native-firebase')
    implementation project(':rn-fetch-blob')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-maps')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-document-picker')
    implementation project(':react-native-device-info')
    implementation project(':react-native-firebase')
    implementation 'com.google.firebase:firebase-core:+'
    implementation "com.google.firebase:firebase-firestore:+"
    implementation "com.google.firebase:firebase-messaging:+"
    implementation project(':react-native-device-info')
    implementation "com.android.support:multidex:1.0.2"
    implementation (project(':react-native-document-picker'))
    implementation (project(':rn-fetch-blob'))
    implementation (project(':react-native-image-picker'))
    implementation (project(':react-native-vector-icons'))
    implementation fileTree(dir: "libs", include: ["*.jar"])
    // implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    
    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:+'
    implementation 'com.google.android.gms:play-services-maps:+'
    // implementation 'com.android.support:appcompat-v7:27.1.0'
    // implementation 'com.android.support:design:27.1.0'

}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}
apply plugin: 'com.google.gms.google-services'

我已经在这里呆了很长时间了。该如何解决该问题?

0 个答案:

没有答案