React-Native 异常与解决集

1:

FAILURE: Build failed with an exception.

* What went wrong:
Failed to capture snapshot of output files for task ':app:processDebugResources' property 'sourceOutputDir' during up-to-date check.
> Could not read path 'I:\ReactProject\Project\ReactNativeDemo\android\app\build\generated\source\r\debug\android\arch\lifecycle\livedata\core'.

解决方法:cd android 

gradlew clean

2:react-native-picker package android.support.annotation does not exist import android.support.annotation.Nullable

解决方法:import android.support.annotation.Nullable; ——>import androidx.annotation.Nullable;

 

3:react-native-picker打包异常

> Task :react-native-picker:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-picker:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  I:\ReactProject\Project\a9app\amor\node_modules\react-native-picker\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRa
dius not found.
  I:\ReactProject\Project\a9app\amor\node_modules\react-native-picker\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerR
adius not found.
  I:\ReactProject\Project\a9app\amor\node_modules\react-native-picker\android\build\intermediates\res\merged\release\values\values.xml:2727: error: resource android:attr/fontVariationSettin
gs not found.
  I:\ReactProject\Project\a9app\amor\node_modules\react-native-picker\android\build\intermediates\res\merged\release\values\values.xml:2728: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

解决方法:

打开文件:node_modules/react-native-picker/android/build.gradle

修改为:

android {
    compileSdkVersion 28
    //buildToolsVersion "23.0.1"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
}

4:错误: 程序包android.support.v4.content不存在

解决方法:

android/app/build.gradle中添加

dependencies{
    implementation 'com.android.support:support-v4:22.2.0'
}

 

你可能感兴趣的:(React-Native)