Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

After update Android Studio from 4.1.3 to version 4.2.1 SharedPrefs_ always null #2303

Open
DenisFedak84 opened this issue May 21, 2021 · 3 comments

Comments

@DenisFedak84
Copy link

DenisFedak84 commented May 21, 2021

AndroidAnnotations version: 4.8.0

Android compile SDK version:29

Annotated code:
@eApplication
public class XXXXX extends SharedApplication {
.....
@PREF
SharedPrefs_ sharedPrefs;
....
}

Expected generated code:
sharedPrefs should be created

Actual generated code:
sharedPrefs null

Stacktrace in case of AA crash:
java.lang.RuntimeException: Unable to create application xxx.xxx.xxx.xxxApplication_: java.lang.NullPointerException: Attempt to invoke virtual method 'xxx.xxx.xxx.xxx.SharedPrefs_$SharedPrefsEditor_ xxx.xxx.xxx.xxx.SharedPrefs_.edit()' on a null object reference

**Android gradle plagin version 4.1.0
** Gradle version 6.5

@zizibuba
Copy link

zizibuba commented Jun 7, 2021

I have the same problem. I had to revert to an older Android Studio version.

@vxhviet
Copy link

vxhviet commented Jul 14, 2021

The null is due to kapt won't be able to generate the necessary classes. I believe Gradle is also a part of the problem.
After messing around with various combination of those in Android Studio 4.2.1, I find that:

  • AA 4.5.2 only work up to Gradle 4.8.1 and Android Gradle plugin 3.2.1.
  • AA 4.8.0 only work up to Gradle 6.5 and Android Gradle plugin 4.1.0.

So for the latest Gradle 6.7.1 and Android Gradle plugin 4.2.1, it is still failing to generate the code.

@ptsiogas
Copy link

ptsiogas commented Mar 31, 2022

@vxhviet it sounds like the library is deprecated because it cannot support the latest gradle versions, is it true?
Also, should we consider migrating to something else?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants