error: package com.android.annotations does not exist

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

I have the following class

import com.android.annotations.NonNullByDefault;

@NonNullByDefault
public final class Log {
    ...
}

and here

13条回答
  •  旧时难觅i
    2020-12-13 12:25

    I had similar issues when migrating to androidx.

    If by adding the below two lines to gradle.properties did not solve the issue

    android.useAndroidX=true
    android.enableJetifier=true
    

    Then try

    1. With Android Studio 3.2 and higher, you can migrate an existing project to AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar (developer.android.com)

    If you still run into issues with migration then manually try to replace the libraries which are causing the issue.

    For example

    If you have an issue with android.support.annotation.NonNull change it to androidx.annotation.NonNull as indicated in the below class mappings table.

    Class Mappings

    Maven Artifact Mappings

提交回复
热议问题