我必须完全重写这个问题。
我有一个反应本机 Android 应用程序。当我建造apk
文件与./gradlew assembleRelease -x bundleReleaseJsAndAssets
,一切顺利,但之后就完全停止编译了。甚至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
没有它们,它可以完美编译。因此,有一个更大的问题无法让它发挥作用。 2天前,所有这些库都运行良好,没有任何问题。但现在有什么东西压垮了它。