as the following picture shows, the source of ListView is not included by the sdk, so how to get the source for this class?
then i may debug into the code of Listview.
Edit1: i am using sdk 2.2, it don't have a module named source code, only android 4.x have such module:(
Type android into your console to open the Android SDK Manager. Expand the Android version you would like to use, mark the Sources for Android SDK checkbox and hit Install. That's everything, you need to do. You will find the sources afterwards in <SDK_PATH>/sources/android-XX. You IDE should now be able to debug into the code (at least NetBeans does).
Edit (for 2.2)
I guess if you really want the sources for 2.2, you will need to checkout the whole android project and switch to the required tag. (Get a list of all tags with git tag -l) You could copy that code to the above mentioned folder, and see if your IDE detects it there.
Related
I'm new to the android studio and it is the first time that I am using it. But when I create a new project, it doesn't show me the window that I have seen in most videos and I don't know what to do.
Picture of create a project window
this is what I get, can anyone please help me what to do? I'm stuck.
You appear to already be inside an Android Studio project named: Project. On the left of the screen you should see a Project tab with the Android Studio icon, click it to view the structure of your project. That is where you will find the bulk of your application: src files, layout files, gradle files, manifest, etc..
This is a great moment for you follow this checklist and take action when necessary:
Make sure you have the Java JDK installed. Open a terminal or command-prompt and type java -version, and javac -version, which will check your Java JRE and Java compiler version respectively. If you don't have them installed you can head over to Oracle's website and download them
Once you have JRE and the Java compiler installed, make sure you properly installed Android Studio. There is extensive documentation to help you get started. Follow this guide: https://developer.android.com/studio/install
Since you are a complete beginner, I recommend following this guide, once you have installed Android Studio correctly. The installation is relatively straightforward, and assuming you used the default configuration during the installation, you should be good to go.
Everything looks normal to me, you just need to familiarize yourself with the IDE itself, so take a look at the links I've attached and I wish you the best!
The environment...
I have a brand new Visual Studio 2015 Android NDK Solution.
This contains 2 projects (the default template code that is generated by visual studio):
A native activity. This is where I want to put Android specific code. It has some default code which fades the screen colour between green and black.
A 'Packaging' project to help with deployment.
I have deployed this successfully to an Intel HAXM virtual device as well as to a real device connected via USB. All good so far.
I then added an Android dynamic library project (.so) - this is where I want to put core code (platform agnostic).
I added a reference to this Core library from the native activity project.
Everything compiles and links fine. I can still create an .APK file.
Other info:
Android SDK 5.1 (Android-22)
Android NDK 21
x86
Clang 3.8
C++ 11
Not using Make files or Gradle
The problem...
Now whenever I deploy to the virtual/real device I get the following error (taken from logcat)
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.NATester/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/app/com.NATester-2/lib/x86/libNATester.so
Things I have tried...
changing the Core library to static (.a)
checked the android device to see if the file exists - it does exist.
Manually deploying the .APK to the android device.
Some articles have suggested using Java code to load the libraries - I want to avoid calling Java code e.g. System.LoadLibrary as this seems like a hack - I feel that it should be possible to to have a pure C++ application on android. I can't be the only person to run into this issue?!
This looks relevant but old and again an unnecessary hack for what must be very common situation
- Can't load native shared library with dependencies in a native activity app
- https://github.com/ikonst/android-dl
For what its worth, I am a seasoned C# developer with Visual Studio (15 years).
I therefore take a lot of things for granted when developing apps - this is my first project using C++/Android and it seems more of a manual battle to get everything to work!
Been struggling for a while but managed to deploy the libraries, quite easy in the end.
Right click on the project [theProject (Andorid-xx)] in the Solution Explorer and select add new item, add your .so library.
Right click on the newly added library and select properties, item type should be library, set Content to Yes, this will deploy the lib.
I have not been able to trigger breakpoints set in Android source files (framework source files, as opposed to my application's source files). I have attached the Android source files, so I can see them and set breakpoints, but when I run in debug mode, these breakpoints are not triggered. I have also tried adding Class Loader breakpoints: this works fine on Android source classes. I am using Eclipse 3.7.2, and I've tried with several different Android SDK versions.
Robguinness,
It looks like what you would like to do is debug Android framework, right? The best method of doing this, from what I understand, is to import the AOSP project into Android Studio (only recognizes Java files) by running "make idegen && development/tools/idegen/idegen.sh" and then opening the android.ipr file that it generated in Android Studio. You can then hook up your emulator and set breakpoints in the Java code.
There are also a wide selection of tools to debug the Kernel, C native code, etc. but there it is such a long topic to cover on this site. If you are interested in more specifics, I would highly recommended Karim Yaghmour's class on Android Debugging (http://www.opersys.com/training/android-debug-and-performance). He has also given several talks at AnDevCon that should be freely available on Youtube about AOSP and Android Internals.
Best Wishes!
I am new in android framework development .
I try to add a service in platform/base and then I make the whole platform folder follow a post online.
Now i don't know how this change can be applied to android application. Do I need to get a new android.jar package for the application?
Thanks
update --------------------------------------------
currently I have the android source code and modified its framework by adding a testservice.java following this : Android-Adding SystemService
Then I need to write a test app to use this testservice. But I don't how to add an app to that modified android source code. I try to following this:set up the Eclipse IDE for Android platform development to add app src path to eclipse build path , I doesn't work.
before this i use eclipse and ADT to write android apps, i am wondering is there any way to write an app in the modified android source code ?
Thanks
I copied an app under [androidroot]/packages/apps/ folder and rename it and modify some code . Then it shows in application list. It works!
But the problem is the directory structure is strange , very different from the one I create from the eclipse + sdk .
So is there anyone know how to develop apps under a modified android framework.
Thanks !!!
I see a quick and dirty solution: replace the corresponding android.jar in the install SDK location (for example $ANDROID_HOME/platforms/android-8/android.jar if you deriver from Android 2.2).
Also you may try to spoof a separate platform revision in $ANDROID_HOME/platforms. Something like android-99 to avoid clashes with the actual future platforms.
Though all of these are dirty tricks this may work for quick testing of your platform code without much pain.
It is exactly the same as the project you create using eclipse. What's more all you need is to write a makefile in the directory.
Then mmm framework/res framework systemserver
bw
I need to edit the original Android Apps from packages
in terms make my own distro/mod..
I want to make changes to the In Call screen, lock screen, contacts, calendar etc..
I understand that for doing this I will have to build everything from
source,
however I need to edit the source and to do so I need to open the OS provided apps as
eclipse projects,
When I did I saw that there are
missing imports which are hidden in the SDK (or missing)
hidden parameters within the classes..
I don't want to use reflection since the whole code is here and
available, but how do you build a platform development kit..
or PDK ?:)
Can any one help?
You start by reading the documentation.
EDIT:
If you are trying to download some single project from AOSP and compile it using the SDK, odds are very strong that it will not work, and that you will encounter problems like the ones you cite. You do not build Android by building individual apps; you build Android ("my own distro/mod") by building the entire firmware. Most AOSP applications are not designed to be compiled by the SDK, but need the whole firmware.
Please check Using eclipse to browse and edit AOSP. You can atleast edit your code using eclipse, but you will have to use AOSP build system to build your distro.
You might also check Debugging Android Java Framework services as that would help debug your changes.
Just open Eclipse,
then go to "window" +"preferences" +"android"
there you will get sdk location,then give the appropriate path of the android sdk for proper run...