首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在Android中不安装依赖项

在Android中不安装依赖项
EN

Stack Overflow用户
提问于 2017-07-20 05:27:44
回答 2查看 2.4K关注 0票数 1

我有一个反应性原生应用程序,我无法构建,因为依赖关系是不可用的。查看全错误输出,或者这个片段:

代码语言:javascript
复制
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':react-native-admob'.
      > Could not resolve all dependencies for configuration ':react-native-admob:_debugPublishCopy'.
         > Could not find com.android.support:support-core-ui:25.2.0.
           Required by:
               TennisAce:react-native-admob:unspecified
               TennisAce:react-native-admob:unspecified > com.facebook.react:react-native:0.42.3 > com.android.support:appcompat-v7:23.0.1 > com.android.support:support-v4:25.2.0
               TennisAce:react-native-admob:unspecified > com.facebook.react:react-native:0.42.3 > com.android.support:appcompat-v7:23.0.1 > com.android.support:support-v4:25.2.0 > com.android.support:support-fragment:25.2.0

在Android中,我尝试过几次带有Gradle文件的同步项目,但是没有安装依赖项。

我尝试过使缓存失效/重新启动之后,Gradle构建也会出现相同的错误

这是我的android/build.gradle文件

代码语言:javascript
复制
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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"
        }
    }
}

这是我的android/app/build.gradle文件

代码语言:javascript
复制
apply plugin: "com.android.application"

import com.android.build.OutputFile

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultConfig {
        applicationId "com.tennisace"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 5
        versionName "1.1"
        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"
            signingConfig signingConfigs.release
        }
    }
    // 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 {
    compile project(':react-native-admob')
    compile project(':react-native-photo-view')
    compile project(':react-native-share')
    compile project(':react-native-linear-gradient')
    compile project(':react-native-vector-icons')
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.facebook.react:react-native:+'
    // From node_modules
    compile 'com.google.android.gms:play-services-base:+'
    compile 'com.google.android.gms:play-services-ads:+'
    compile project(':react-native-onesignal')
    compile project(':react-native-billing')
}

// 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'
}
EN

Stack Overflow用户

发布于 2017-07-29 06:55:44

从Android卸载并重新安装解决了此错误。

票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45205868

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档