錯誤日誌:
> Task :react-native-cookies:verifyReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-cookies:verifyReleaseResources'.
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
解決方案
這個問題原本不是rn版本的問題,原因是0.61.3將Android SDK的版本更新到28了,這與有些原生代碼的插件不兼容了,因爲第三方更新不及時,SDK還是舊的版本。
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.facebook.react:react-native:+'
}
在react-native-cookies
的build.gradle中,把compileSdkVersion
,targetSdkVersion
都改爲28,把dependencies的compile
改成implementation
,再重新打包就不報錯了