【发布时间】:2017-11-10 13:43:18
【问题描述】:
我已在项目中将 buildToolsVersion 更新为“26.0.2”,现在在尝试构建发布 apk 时出现此类错误。任何想法如何解决它?
com.android.ide.common.process.ProcessException:执行时出错 处理 /Users/Iryna/Library/Android/sdk/build-tools/26.0.2/aapt 与 参数 {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 错误:
找不到参数的方法 implementation() [com.google.firebase:firebase-core:11.6.0] 对象类型 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler。 打开 文件
build.gradle 应用程序
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()
}
}
【问题讨论】:
-
分享你的
Build.Gradle -
从项目中删除您的构建文件夹,将您的项目移动到另一个目标而不是尝试运行..
-
@Prem 感谢使用编译而不是实现的想法,我将构建工具降级到 25.0.0 并将 firebase 降级到 11.0.4。现在一切正常!
标签: android firebase react-native android-gradle-plugin