我无法弄清楚构建有什么问题 . 我尝试了运行./gradlew clean的常用解决方案,以及将android.enableAapt2 = false添加到gradle.properties .
google-services.json文件夹位于/ android / app级别 .
我现在不知道如何通过这个 .
如果我忘了包含一些有用的东西请lmk我会更新 .
干杯
错误输出
配置项目:app警告:指定的Android SDK Build Tools版本(26.0.1)将被忽略,因为它低于Android Gradle Plugin 3.1.3的最低支持版本(27.0.3) . 将使用Android SDK Build Tools 27.0.3 . 要取消此警告,请从build.gradle文件中删除“buildToolsVersion '26 .0.1'”,因为每个版本的Android Gradle Plugin现在都有一个默认版本的构建工具 . 在查看[src / nullnull / debug,src / debug / nullnull,src / nullnull,src / debug,src / nullnullDebug] registerResGeneratingTask时,无法找到google-services.json,请使用registerGeneratedResFolders(FileCollection)找不到google- services.json在查看[src / nullnull / release,src / release / nullnull,src / nullnull,src / release,src / nullnullRelease] registerResGeneratingTask时不推荐使用registerGeneratedResFolders(FileCollection)配置项目:react-native-google-analytics -bridge警告:配置'compile'已经过时,已被'implementation'和'api'取代 . 它将在2018年底删除 . 有关更多信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html配置项目:react-native-radar警告:配置'编译'已经过时,已被'implementation'和'api'取代 . 它将在2018年底删除 . 有关详细信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html任务:app:processDebugGoogleServices解析json文件:/ Users / kyletreman / 18F / courier_test_app / android / app / google-services.json /Users/kyletreman/.gradle/caches/transforms-1/files-1.1/appcompat-v7-23.0.1.aar/64df69838d7c555de168bdcf18f3be5c/res/values/values.xml :113:5-69:AAPT:错误:资源android:attr / fontVariationSettings not found . /Users/kyletreman/.gradle/caches/transforms-1/files-1.1/appcompat-v7-23.0.1.aar/64df69838d7c555de168bdcf18f3be5c/res/values/values.xml:113:5-69:AAPT:错误:资源android :找不到attr / ttcIndex . 错误:链接引用失败 . FAILURE:构建因异常而失败 . 出了什么问题:任务':app:processDebugResources'执行失败 . 无法处理资源,请参阅上面的aapt输出以获取详细信息 . 尝试:使用--stacktrace选项运行以获取堆栈跟踪 . 使用--info或--debug选项运行以获取更多日志输出 . 使用--scan运行以获得完整的见解 . 在https://help.gradle.org获取更多帮助在2s中执行失败50个可操作的任务:3个已执行,47个最新无法在设备上安装应用程序,请阅读上面的错误以获取详细信息 . 确保您运行的是Android模拟器或已连接设备并设置了Android开发环境:https://facebook.github.io/react-native/docs/getting-started.html
/android/app/build.gradle
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.courier_test_app.app"
minSdkVersion 16
targetSdkVersion 27
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(project(':react-native-firebase')) {
transitive = false
}
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.android.support:support-v13:27.1.1'
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-radar')
implementation project(':react-native-google-analytics-bridge')
}
// 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.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
/android/build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.google.gms:google-services:4.0.0'
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
3 回答
从错误日志中我可以看到
appcompat-v7-23.0.1
仍在使用中 . 因此,它可能有助于更新resolutionStrategy:您还需要将该解决方案策略块放在app / build.gradle中
Fixed
我能够从熟悉本土方面的人那里获得帮助,他帮助我解决了很多错误 .
从android文件夹 . 问题是其中一个依赖是拉旧版本,这是通过在resolutionStrategies中使用以下内容修复的 .
对此
我能给出的最后一个提示是命名很重要,除非绝对必要,否则不要重命名你的应用程序,并确保它在主java文件和AndroidMainfest.xml .
UPDATED
将此代码放在 android/build.gradle 的末尾,使用您自己的数字为 compileSdkVersion 和 buildToolsVersion