error: package com.android.annotations does not exist

后端 未结 13 2316
南旧
南旧 2020-12-13 11:55

I have the following class

import com.android.annotations.NonNullByDefault;

@NonNullByDefault
public final class Log {
    ...
}

and here

13条回答
  •  粉色の甜心
    2020-12-13 12:37

    To automatically fix all android to androidx issues for React Native (prerequisite npx)

    Add the following two flags to true in your gradle.properties file at ProjectFolder/android/gradle.properties

    android.useAndroidX=true
    android.enableJetifier=true
    

    Execute

    npm install --save-dev jetifier
    npx jetify
    npx react-native run-android
    

    In your package.json add the following to scripts

      "postinstall" : "npx jetify"
    

    More info at https://github.com/mikehardy/jetifier

    Update: This is now in-built in react-native 0.60. If you migrate to react-native 0.60 you won't need this step. - https://facebook.github.io/react-native/blog/2019/07/03/version-60#androidx-support

提交回复
热议问题