Use custom SDK in android studio to access new API - android

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

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.

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

Related

How do I configure Android SDKs for Android Studio 3.2.1?

I downloaded the latest version (3.2.1) of Android Studio from the Android Developers site.
After installing the application, it won't start. I get an error message when clicking on "Start a new Android Studio project":
Your Android SDK is missing, out of date or corrupted.
I read an outdated post dealing with the same issue but an older version of the application. I followed the solution described there and got stuck after navigating to Configure > Project Defaults > Project Structure. This is the window I see right now:
I can't find the SDK. Where is it located? Does it not get installed together with the app? If so, where can I download it from?
I can't find the SDK. Where is it located? Does it not get installed
together with the app? If so, where can I download it from?
That depends on how you installed the Android Studio. With the SDK packages (called bundle) or you have installed it separately which doesn't have SDK packages.
Where is it located
It's mostly uses:
C:\Users\<username>\AppData\Local\Android\Sdk
Directory on windows if you install SDK Manager, it will be easy to figured out.
where can I download it from
After installing Android SDK Manager, you'll need to download some packages like;
Platform-tools
Build-tools
Support library
And etc
To be able to compile-use Android Studio which is a general question and use Google for that.

add Android SDK from AOSP to Intellij

Just compiled android 8.0 source code. I'm fairly new to AOSP.
It is quite confusing, the ./out contains a lot of files.
Currently, i couldn't create android project on Intellij yet, because i haven't specify the android SDK.
I want to add my customized ROM as android SDK to Intellij, instead of downloading SDKs.
Does anyone had similar experience loading their own ROM to android app IDE?
You just need to trigger a SDK built, e.g.
$ . build/envsetup.sh
$ lunch sdk_x86_64-eng
$ m -j sdk
Afterwards, you have your SDK at out/host/darwin-x86/sdk/sdk_x86_64. Point your Android Studio SDK location (in Project Settings) to that folder and you should be good to go. You might need to install the required build tools, but the IDE prompts for it in case.

Android Studio: Please Select Project SDK - What does this mean?

I'm importing this project from Github into Android Studio 2.1.2. I'm at a point where it's asking me "Please select project SDK. This SDK will be used by default by all project modules." There are 2 options - "1.7" or "Android API 23 Platform". How do I know which one to pick? The "1.7" option has a ton of files while the other has only 2 files.
My overall goal is to just open this project and learn from it. I wanted to look at the source code for a functioning project that is not as simple as the tutorials given for Android Studio. I wanted a bit more complexity.
That means you probably haven't configured Android Studio. YOu have to install Android SDK in order for everything to work.
I cannot find the raw SDK download link, so you probably have to use Android Studio to download it.
Also, you should download Java 8 to get all functionality of Android Studio 2.1.2(Android Studio 2.x requires java 8(or higher)) so selecting 1.7 is probably for compatability mode

How to update Android NDK in place?

I used to download the Android NDK as new version were pubished to the devloper website.
It appears Google has recently updated the developer website and removed direct NDK download links, and replaced them with a a bunch of circular references that eventually lead to the SDK download. The SDK download page does not include the NDK. The closest I have found to a download and NDK is Download Android Studio and SDK Tools.
Running $ sudo /opt/android-sdk-macosx/tools/android does not offer a way to update the NDK.
How do I update the NDK in place using the existing NDK or one of the SDK tools?
Or where is the download of the actual NDK located?
To be clear, I use ant and ndk-build from the command line. I don't use Eclipse or Android Studio. Eclipse and the Android plugin is broken; and Android Studio does not really support NDK and JNI.
Plus, I don't really want to learn another editor since I kind of know Eclipse, and I know already how to do it from the command line (so there's no need for an editor).
In Android Studio, go to Tools (top-menu item) > Android > SDK Manager
Click SDK Tools tab
Scroll down and you will see NDK as an option, with detail if an update is available

How do you add an SDK to Android Studio?

I'm using Google's Android Studio 0.1 based on IntelliJ, and I cannot figure out how to add additional SDKs to my project.
I exported my existing project from Eclipse to a Gradle project, which I imported into Android Studio, as recommended by Google.
My project's SDK is Google APIs 2.3.3. However, I use a library called PullToRefresh which appears to need SDK 4.1, so I'm trying to add the SDK 16 to my project.
I've already made sure to download the SDK using the SDK manager. These SDKs are added to the Android Studio.app's sdk folder automatically.
I opened the Project Structure window, clicked "SDKs" under Platform Settings, and I currently see JDK 1.7 and Google APIs 2.3.3 shown. I click the + sign above that list to add a new SDK. I then navigate to the sdk directory that has android-16, as shown in the screenshot below. I am not quite sure what this wants me to add, but I've highlighted the android-16 folder (about the only thing I can select), and when I click "Choose," the window disappears, but no new SDK appears in the SDK list.
And here is a screenshot of my SDK Manager view, showing the installed SDKs:
I had opened a ticket also with Google's support, and received the solution. Instead of choosing the sdk/platform/android-16 folder, if you select the top-level "sdk" folder instead, you'll then be asked to choose which SDK you want to add. This worked!
You have to put your SDK's in a given directory or .app directory. You have to do it in finder while you are out of the application i'm assuming, but personally I'd use terminal in Mac instead of doing it in the App itself or finder. According to Google:
On Windows and Mac, the individual tools and other SDK packages are saved within the Android Studio application directory. To access the tools directly, use a terminal to navigate into the application and locate the sdk/ directory. For example:
Windows: \Users\<user>\AppData\Local\Android\android-studio\sdk\
Mac: /Applications/Android\ Studio.app/sdk/
You can change from the "build.gradle" file the line:
compileSdkVersion 18
to the sdk that you want to be used.
I had to restart Android Studio for changing the sdk after installing a new one. Then Android Studio asked me for configuring my SDK and let me do it.
And For linux(ubuntu)
/usr/share/android-studio/data/sdk
Download your sdk file, go to Android studio: File->New->Import Module
I followed almost the same instructions by #Mason G. Zhwiti , but had to instead navigate to this folder to find the SDK:
/Users/{my-username}/Library/Android/sdk
I'm using Android Studio v1.2.2 on Mac OS
For those starting with an existing IDEA installation (IDEA 15 in my case) to which they're adding the Android SDK (and not starting formally speaking with Android Studio), ...
Download (just) the SDK to your filesystem (somewhere convenient to you; it doesn't matter where).
When creating your first project and you get to the Project SDK: bit (or adding the Android SDK ahead of time as you wish), navigate (New) to the root of what you exploded into the filesystem as suggested by some of the other answers here.
At that point you'll get a tiny dialog to confirm with:
Java SDK: 1.7 (e.g.)
Build target: Android 6.0 (e.g.)
You can click OK whereupon you'll see what you did as an option in the Project SDK: drop-down, e.g.:
Android API 23 Platform (java version "1.7.0_67")

Categories

Resources