将buildToolsVersion更新为' 26.0.2'

时间:2017-11-10 13:43:18

标签: android firebase react-native android-gradle

我已将buildToolsVersion更新为' 26.0.2'在项目中,现在我在尝试构建发布apk时遇到了这样的错误。任何想法如何解决?

  

com.android.ide.common.process.ProcessException:执行时出错   进程/Users /Iryna/Library/Android/sdk/build-tools/26.0.2/aapt with   参数{package -f --no-crunch -I   /Users/Iryna/Library/Android/sdk/platforms/android-25/android.jar -M   /Users/Iryna/Documents/Projects/xxx/mobile/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml   -S / Users / Iryna / Documents / Projects / xxx / mobile / android / app / build / intermediates / res / merged / release   -m -J

我已经尝试过回到旧版本(25.0.0)的构建工具,但是如果我减少它,我会得到gradle错误:

  

找不到参数的方法实现()   类型对象上的[com.google.firebase:firebase-core:11.6.0]   org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler。   打开   文件

build.gradle app

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.cityfalcon"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 10
        versionName "1.8"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary true
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        debug {
            storeFile file(XXX_RELEASE_STORE_FILE)
            storePassword XXX_RELEASE_STORE_PASSWORD
            keyAlias XXX_RELEASE_KEY_ALIAS
            keyPassword XXX_RELEASE_KEY_PASSWORD
        }
        release {
            storeFile file(XXX_RELEASE_STORE_FILE)
            storePassword XXX_RELEASE_STORE_PASSWORD
            keyAlias XXX_RELEASE_KEY_ALIAS
            keyPassword XXX_RELEASE_KEY_PASSWORD
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
            debuggable false
        }
        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 {
    implementation 'com.google.firebase:firebase-core:11.6.0'
    implementation 'com.google.firebase:firebase-crash:11.6.0'
    compile project(':react-native-linkedin-login')
    compile project(':react-native-twitter-signin')
    compile project(':react-native-google-signin')
    compile project(':react-native-fbsdk')
    compile project(':react-native-spinkit')
    compile project(':react-native-linear-gradient')
    compile('com.twitter.sdk.android:twitter:2.3.2@aar') {
        transitive = true;
    }
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:design:25.0.0'
    compile 'com.facebook.react:react-native:0.39.2'
    // From node_modules
    compile 'com.instabug.library:instabug:4.0.8'
    compile(project(':react-native-google-signin')) {
        exclude group: "com.google.android.gms" // very important
    }
    compile 'org.piwik.sdk:piwik-sdk:1.0.2'
    compile 'com.google.android.gms:play-services:11.6.0'
    compile 'com.newrelic.agent.android:android-agent:5.12.0'
}

// 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'
}
apply plugin: 'com.android.application'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

// Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

build.gradle项目:

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.google.gms:google-services:3.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'io.fabric.tools:gradle:1.22.2'
        classpath "com.newrelic.agent.android:agent-gradle-plugin:5.12.0"
    }
}

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

}

1 个答案:

答案 0 :(得分:3)

  

我已经尝试回到旧版本(25.0.0)的构建工具,但是如果我正在减少它,我就会出现gradle错误:

     

Could not find method implementation() for arguments

old version (25.0.0) 使用 compile 代替 implementation

compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-crash:11.6.0'