My project can't build after I migrate to AndroidX, the error log show error: package android.support.annotation does not exist
in some class, but these class can't be edited, when I edit these class and rebuild, these will be recovered. When open these class will show Files under the "build" folder are generated and should not be edited.
and when edit these class will show Generated source files should not be edited. The change will be lost when sources are regenerated.
I try to clean my project then sync and rebuild, but didn't work, how can I fixed that, thank you.
Here is my error log:
C:/Users/Myname/AndroidStudioProjects/PGapp
app/build/generated/source/apt/debug/com/gmpsykr/goma/GlideOptions.java
error: package android.support.annotation does not exist
error: package android.support.annotation does not exist
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
app/build/generated/source/apt/debug/com/gmpsykr/goma/GlideRequest.java
app/build/generated/source/apt/debug/com/gmpsykr/goma/GlideRequests.java
app/build/generated/source/apt/debug/com/bumptech/glide/GeneratedRequestManagerFactory.java
app/build/generated/source/apt/debug/com/bumptech/glide/GeneratedAppGlideModuleImpl.java
Here is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId 'MyId'
minSdkVersion 24
targetSdkVersion 28
versionCode 5
versionName "1.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'com.android.billingclient:billing:2.0.2'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-auth:18.1.0'
implementation 'com.google.firebase:firebase-storage:18.1.1'
implementation 'com.google.firebase:firebase-database:18.0.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.google.firebase:firebase-ads:18.1.1'
implementation 'com.firebaseui:firebase-ui-storage:5.0.0'
implementation 'com.facebook.android:audience-network-sdk:5.4.1'
implementation 'com.facebook.android:facebook-android-sdk:5.4.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.4'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation files('libs/jsch-0.1.55.jar')
}
apply plugin: 'com.google.gms.google-services'
Here is my gradle.properties:
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.enableJetifier=true
I think it have a problem with Glide Library.
Can you just delete this part? annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
After that you should click Refactor -> Migrate to AndroidX