2

I am working on a school project which needs to customize AOSP. I have built an new API, also I have written apps that used these new API and they were compiled in my AOSP, they work just fine.

Now I have also compiled a SDK in my AOSP. I followed the instructions on this link to change the SDK path in android studio: Android Studio - How to Change Android SDK Path

However, android studio still cannot resolve my new API. Does anyone have any idea on What I have done wrong? Or do I have some missing SDK tools that I need to install?

AOSP: android-5.0.2_r1

OS: Ubuntu 12.04

Community
  • 1
  • 1
Jack Liu
  • 43
  • 2
  • 9

2 Answers2

3

You will need to build the SDK from your custom version of AOSP. To do this you will need to build the 'sdk-eng' version using lunch and use the 'make sdk' build command. You can find detailed instructions inside the source code of AOSP. Here is a link specifically for the branch of AOSP you are building.

This will produce a custom framework.jar file which contains the Android API for your custom version. These files will just be stubs that do not contain actual code but do provide the API for developers to use. When building your application you will need to reference this framework.jar as your project SDK instead of one of the standard Google provided jars. This SDK jar should not be a compiled dependency as if will be provided by the custom version of Android you are running the application on.

Bobbake4
  • 24,509
  • 9
  • 59
  • 94
0

Go to the folder in:

Android/Sdk/platforms/android-21/

Replace the android.jar with your custom made android.jar SDK and then inside Android Studio go to:

File --> Invalidate Cache & Restart
Nir Duan
  • 6,164
  • 4
  • 24
  • 38
  • You're working on a project with max level and minimum level API of 21? @JackLiu – Nir Duan Aug 26 '16 at 15:14
  • I was told that I can add an interface or library into android studio, which can help sdk to resolve my new API, any idea how to do that? – Jack Liu Aug 26 '16 at 19:15