I've downloaded the source code of android widget "TextView".
I included some other packages, but Eclipse can't find them.
I've checked android source again and they exist there.
import android.content.UndoManager;
import android.text.GraphicsOperations;
import android.content.res.CompatibilityInfo;
So why doesn't Eclipse them? In source code they are also public.
I'm using Android 4.4.2.
If you are trying to build something that is part of AOSP and import it into eclipse, then you need to let eclipse know what those other packages are. Based on android, eclipse only knows about packages that are part of the SDK. This does not include all packages that are part of android.
If you look through the AOSP files, you will find methods and variables that are hidden. Some classes are simply not included in the SDK. Other packages are considered to be "internal" and thus you can not access them easily (infact, if a package is internal eclipse has a line that will specifically block all packages from being imported).
Most likely, you have not updated your build path to include an updated framework.jar file. There are quite a few resources available for these tasks. This answer here: How do I build the Android SDK with hidden and internal APIs available? will give you a quick rundown on how to get a framework.jar file simply if you are building aosp.
If you aren't building AOSP, I suggest you check out this guide here on using hidden and internal parts of the API. From a quick glance, it doesn't look like any of those packages are internal, so you should be fine by just importing the framework jar which contains all the classes and hidden methods.
Good luck!
Just a little list of quick fixes:
try right click on your android-project -> Android Tools -> Fix Project Properties
right click on your android-project -> Android Tools -> Add Support Library...
is your SDK up-to-date? You can check this in your SDK Manager
last thing: go on Project -> make sure that Build Automatically is checked and then do Clean...
Related
How to download the android project from android.googlesourece.com with the Gradle file!! I want to download the DeskClock app
https://android.googlesource.com/platform/packages/apps/DeskClock/+/refs/tags/android-r-preview-2
but the project does not contain the Gradle file, also I did go through the official documentation but I don't really understand well. is there a tutorial guys, can you guys guide me how to get the files with Gradle
These apps are part of AOSP build tree. There are no Gradle files for them. The information on how it is build, what its dependencies are is inside Android.mk (or Android.bp for newer versions) .
To build a such app, you'll have to download the whole AOSP tree, setup the environment, and then you can build a single module using mmm packages/apps/DeskClock.
You could always try to import it in Android Studio, and see if that works.
Apps in the AOSP tree often use non standard SDKs ( methods and classes that aren't part of official SDK that you get when developing Android apps).
It's generally difficult to build them out-of-tree like this. This might be of help for some references https://github.com/anggrayudi/android-hidden-api.
Is there a way to build AOSP's /platform/frameworks/base package source or support library source separately in Android Studio.
I wanted to read the framework (base and support) code in Android Studio and since I didn't want to be bothered about the rest of the packages in AOSP, I only imported the mirrored repo of these two packages as two separate projects in Android Studio. I want to browse through the code by using "jump to source" shortcut (cmd/ctrl+click) of the IDE. But this handy feature won't simply work properly in Android Studio. When I try to jump to the method definition which belongs to a different java source file (It says - "Cannot find declaration to go to"). This limitation of source editor is due to gradle build failure. The project just won't build and throws the following error.
Error:You need a symlink in prebuilts/sdk/99 that points to
prebuilts/sdk/current.Without it, studio cannot understand current
SDK. ln -s ../../prebuilts/sdk/current ../../prebuilts/sdk/99
Is there a way to fix this. I know I can simply browse the source code on http://androidxref.com/ too, but it's not as convenient and powerful as your IDE.
This is possible (having Android Studio be able to show you the framework code and let you use the usual IDE tools), though compiling won't work.
But the detail in your question seems to indicate you don't actually care about compiling, just about viewing/editing.
The first steps listed here:
http://ronubo.blogspot.com/2016/01/debugging-aosp-platform-code-with.html
might work for you. Basically:
Build your AOSP platform
( . build/envsetup.sh && lunch - && make ...)
Create the Android Studio project for importing to
( mmm development/tools/idegen && development/tools/idegen/idegen.sh )
Import the project
( open android.ipr from Android Studio)
Not without a huge effort.
For very many reasons.Ex:
1.the framework depends on different HALs and libraries from system/bionic/external
2.Compiling the framework uses specific tools from linux(flex,bison,libgl etc..)
3.Framework is built using the Android.mk system and needs a lot of flags and compilation macros from build/
I also can't imagine a motivation to do what you are trying to do. If it's going to run on any device, bare in mind device manufacturers modify the framework heavily, even the small ones. Actually the chipset manufacturers modify it and give it to manufacturers that modify it even more.
Error:You need a symlink in prebuilts/sdk/99 that points to prebuilts/sdk/current.Without it, studio cannot understand current SDK. ln -s ../../prebuilts/sdk/current ../../prebuilts/sdk/99
This notice already tell you should run the command:
ln -s ../../prebuilts/sdk/current ../../prebuilts/sdk/99
To tell build system use 'current version sdk' in prebuilts/sdk/current directory replace the temp sdk version 99.
could you try it?
specifically I just want to import ActionBarActivity to my net beans project... you would think that this would be a simple enough task, however that does not seem to be the case. I would be so grateful if there was a fairly simple way to do this... And please bear in mind I am on lesson one of the first android app tutorial on the android developers website so probably wont understand if you give me a hugely complex and technical answer.
Copy the required file (eg. android-support-v13.jar) from the SDK directory into the libs folder in your project. Eg. from android-sdk/extras/android/support/v13.
First of all make sure to install the support lib with SDK manager.
Open project properties, select "JAR Libraries", choose "Custom location", browse to desired directory and press open. You'll have your jar in "Referenced JRA libraries" below. Now just press OK.
PS.
It's do not download libraries manually, instead use SDK manager.
Open "Tools"->"Android SDK manager" and install desired library.
I recently updated ADT to point to Google APIs 18. The install went fine it seems and I'm able to point my Project Properties to Google APIs 18, however, Eclipse can't find the package com.google.cast. Anyone else having this problem?
That's because com.google.cast is not part of Android.
Near as I can tell, you will need to download a ZIP file containing their library project, import it into your IDE, mark it as actually being a library project, then attach that library project to your app.
Actually using those APIs appears to require a whitelisting, and it is in violation of their license to actually distribute an app (or, near as I can tell, source code) without express written permission of Google.
CommonsWare is correct, additionally, you'll need the v18 Android Support Libraries. v7/mediaRouter & v7/appCompat
I finally got this to work for me. Originally, I tried doing it like I used ActionBarSherlock (making it a library, went to Project -> Properties and told it to use that library, etc) but that didn't work. Finally, I got frustrated and simply moved the GoogleCastSdkAndroid-1.0.0.jar file from the lib folder of the library directly into the lib folder of the project.
So, again, I imported from existing code the SDK into my workspace, then took the jar file from its library and put it directly into my project's lib folder. Not sure if that's how it's supposed to be, but the sample TicTacToe game is now error free and runs on my Nexus 4.
It sounds like you're trying to run one of the Google Cast sample apps without having installed the Google Cast SDK. The instructions for installing the SDK and all necessary support libraries were just uploaded here on GitHub. I'm quoting below the relevant section for installing the Cast SDK itself:
http://developer.android.com/tools/support-library/setup.html#libs-with-res
You can either add the Cast SDK as a library project in your workspace, or add
the GoogleCastSdkAndroid-x.x.x.jar directly to the project you're building. The
former is recommended if you have multiple Cast-related projects in your
workspace.
As a library project: Follow the Support Library setup instructions linked
above for your downloaded and extracted SDK.
As an included library:
Copy the /libs folder from your downloaded SDK to your Cast-related project.
In the Package Explorer window, open (your Cast project)/libs and right
click on GoogleCastSdkAndroid-x.x.x.jar. Select Build Path->Add to Build
Path.
So, this is not like other problems. I have basically one question
Android project build system uses the Android.mk files.
Is there any eclipse plugin out there that parses through the mk files and allows me to load those projects into eclipse ? essentially import Android.mk file project...
You can import the whole Android sources into eclipse. The instructions are here. Then you should make some modifications (for instance, include android-common_intermediates/javalib.jar instead of google-common_intermediates/javalib.jar) and you will have possibility to develop in eclipse.
Eclipse separates Android sources to several projects by itself(I think according to classpath entries). If you want to change this behavior you should look in this direction.
If you have tried eclipse instructions at Android source site, you probably would know by now that it leaves lot of details to imagination.
One thing you need to keep in mind is that AOSP build doesn't work with eclipse. As long as you build your code from terminal and use eclipse to edit/browse/debug purposes, you will have more productive sessions.
The article at Using Eclipse to browse/edit Android platform code explains this in step by step.