我试图运行3年前的反应-本土项目。
% ./gradlew assembleDebug --stacktrace
> Configure project :react-native-reanimated
Native libs debug enabled: false
Android gradle plugin: 7.0.4
Gradle: 7.5.1
building Reanimated2
...
> Task :app:processDebugResources FAILED
> Task :react-native-navigation:compileReactNative57_5DebugKotlin FAILED
e: /Users/tenna/Desktop/aitem/node_modules/react-native-navigation/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt: (12, 1): Class 'ModalContentLayout' is not abstract and does not implement abstract member public abstract fun onChildStartedNativeGesture(p0: View!, p1: MotionEvent!): Unit defined in com.facebook.react.uimanager.RootView
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> Android resource linking failed
ERROR:/Users/tenna/Desktop/aitem/android/app/build/intermediates/packaged_manifests/debug/AndroidManifest.xml:66: AAPT: error: attribute android:enableOnBackInvokedCallback not found.
...
android:enableOnBackInvokedCallback在每个AndroidManifest.xml中都有。
gradle.properties:
android.disableAutomaticComponentCreation=true
android.suppressUnsupportedCompileSdk=33
android.useAndroidX=true
android.enableJetifier=true
发布于 2022-10-19 12:16:42
此错误是由以下更新引起的:https://developer.android.com/guide/navigation/predictive-back-gesture
要构建应用程序,请遵循以下步骤:在android/build.gradle中设置相当于33的编译和目标sdk版本:
buildScript {
ext {
...
compileSdkVersion = 33
targetSdkVersion = 33
...
}
...
}
然后在android/app/build.gradle中添加新的依赖项:
dependencies {
...
implementation "androidx.activity:activity:1.6.0-alpha05"
...
}
在您的AndroidManifest中,向标记添加新属性:
<application
...
android:enableOnBackInvokedCallback="true"
>
最后,执行分级同步并构建项目。
https://stackoverflow.com/questions/73914874
复制相似问题