Error showing in build.gradle file. Android Version - 11 Android Studio - Giraffe
- I am trying to create a custom SDK which contains API developed by me. I want to access these API's in Android Studio.
- I found out that there are two ways to do it
- Android SDK-Addon
- Android Custom SDK I am trying the 2nd way.
How i created Custom SDK:
- I have aosp source code for Android 11 and I Have added a Custom System Service in frameworks/base folder and made it to start when system server starts. (FYI: I am aware of the consequences if i add system services in frameworks, It's just for learning purpose). *I used this blog as a reference
- I even accessed the API in application using getSystemService("API_MANAGER_NAME").
- To access the same API in Android Studio I created a custom SDK from my AOSP.
- To build custom SDK i followed Google documentation- lunch my_menu and make sdk
- After this i could able to see Android SDK in /out/host/linux-x86/sdk/. I verified in the platform/android.jar and it contains my API stub class.
- I gave the path of my custom Android SDK in Android Studio and extracted the contents.
PROBLEM:
The API i built is for 30( Android 11) but in Android Studio Gradle file Application is set to target and compile for API version 34 (Android 13).
If I try to access my API with this changes i cannot able to see my API and import will also fail.
I tried to change the compile and target sdk version to 30 and i found that this error (Screenshot)
With the degraded versions of API 30, I could able to import my API but the dependencies associated in gradle file will fail. It targets for API version 33 only.
I want to have an application which is targeting for API 30 ( compile, min, and target all pointing to same API level which is 30 ) and dependency present in gradle file to be compatible with this changes. So that i can import my custom API without resulting in Automotive debug resource fail error.
I tried changing the API versions in gradle and it resulted in error of the library present in gradle file.