我不得不完全重写这个问题.
我有一个本地安卓apply.当我用./gradlew assembleRelease -x bundleReleaseJsAndAssets
构建apk
文件时,它运行得很好,但在那之后它就完全停止了编译.即使react-native run-android
也不起作用了.
到目前为止,我发现:
Task :app:processDebugResources FAILED
resource android:attr/fontVariationSettings not found.
resource android:attr/ttcIndex not found.
如果我把这些行加上gradle.properties
,
android.useAndroidX=true
android.enableJetifier=true
错误会发生变化.现在是这个
Task :@JWWon_react-native-universal-pedometer:compileDebugJavaWithJavac FAILED
error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
cannot find symbol
private void sendPedometerUpdateEvent(@Nullable WritableMap params) {
^
symbol: class Nullable
location: class BMDPedometerModule
但问题不在于图书馆.如果我开始抱怨,就把它从另一个项目中移除.要编译它,我必须删除7个库.举个例子:
Task :@react-native-community_netinfo:compileDebugJavaWithJavac FAILED
error: package android.support.v4.net does not exist
import android.support.v4.net.ConnectivityManagerCompat;
error: cannot find symbol
promise.resolve(ConnectivityManagerCompat.isActiveNetworkMetered(getConnectivityManager()));
^
symbol: variable ConnectivityManagerCompat
location: class ConnectivityReceiver
2 errors
如果我移除另一个,就会发生这种情况:
Task :react-native-camera-kit:compileDebugJavaWithJavac FAILED
package android.support.annotation does not exist
import android.support.annotation.ColorInt;
^
package android.support.annotation does not exist
import android.support.annotation.IntRange;
^
...
92 errors
因此,如果我从项目中删除7个库,它将编译.他们是:
react-native-camera-kit
@react-native-community_netinfo
react-native-push-notification
react-native-sensors
@JWWon_react-native-universal-pedometer
react-native-keep-awake
react-native-toast-native
没有它们,它就能完美地编译.因此,还有一个更大的问题,就是它无法发挥作用.两天前,所有这些库都工作正常,没有问题.但现在有什么东西把它压碎了.