Fra*_*rew 2 android gradle reactjs react-native
安装'react-native-get-sms-android'后,我在构建本机反应时遇到问题,您可以在这里找到https://www.npmjs.com/package/react-native-get-sms-android,我不知道不知道为什么,我尝试寻找类似的错误,但都失败了。
这是完整的错误:
> Task :app:processReleaseGoogleServices
Parsing json file: D:\Project\React Native\myProject\android\app\google-services.json
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values-v26\values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.
C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values-v26\values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.
C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values-v26\values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontStyle not found.
C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/font not found.
C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontWeight not found.
error: failed linking references.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-get-sms-android:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3m 54s
203 actionable tasks: 4 executed, 199 up-to-date
Run Code Online (Sandbox Code Playgroud)
请任何人帮助我解决此问题。
谢谢。
错误原因:
你已经安装了 react-native-get-sms-android作为依赖,这个错误的原因是你android/app/build.gradle和 你的配置node_modules/react-native-get-sms-android/android/build.gradle不匹配。
解决方案
node_modules/react-native-get-sms-android/android/build.gradlecompileSdkVersion buildToolsVersion minSdkVersion
targetSdkVersion与您相同android/app/build.gradle./gradlew assembleRelease从终端运行。 您需要更新您的android build tools version。以下对我有用。在android/build.gradle变化ext看起来像这样:
ext {
buildToolsVersion = "28.0.0"
minSdkVersion = ... // your min SDK
compileSdkVersion = 28
targetSdkVersion = ...// your target SDK
supportLibVersion = "28.0.0"
}
Run Code Online (Sandbox Code Playgroud)
并将其放在文件末尾:
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "28.0.0"
}
}
}
afterEvaluate {
project -> if (project.hasProperty("android")) {
android {
compileSdkVersion 28
buildToolsVersion '28.0.0'
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
在android/app/build.gradle此更改"com.android.support:appcompat-v7:27.1.1":"com.android.support:appcompat-v7:28.0.0"
| 归档时间: |
|
| 查看次数: |
840 次 |
| 最近记录: |