This article is based on the source code of Development/tools/idegen/readme as a guide document.
Environment: Ubuntu 14.10,openjdk 1.7,android Studio 1.0.2,android-5.0.1_r1 Source
Since as is developed based on IntelliJ idea, this article is also applicable to IntelliJ idea
First, modify the memory configuration of Android Studio (hereinafter referred to as)
because you need to consume a lot of memory when importing the source code, first modify idea_home/bin/studio.vmoptions The values in -xms and -xmx . 748m is used in the document and can be modified by itself.
Ii. JDK, SDK for configuring as
Add a JDK with no classpath in the IDE to ensure that the library files in the source code are used
and use it as the Java SDK for the SDK to be used. Such as
Iii. generating the required configuration file for import as (*.IPR)
① Compile the source code (to ensure that a. java file is generated, such as R.java; if compiled, no need to compile again)
② Check if there are Idegen.jar in the out/host/linux-x86/framework/directory
If Idegen.jar does not exist, execute:
Mmm development/tools/idegen/
In the source code of the 5.0.1 will generate Res.java folder, resulting in Idegen.jar run-time throw filenotfoundexception, which is not strict idegen codes caused.
My share has patches to fix this bug, or I'll use the Idegen.jar I shared directly.
③ execution
Development/tools/idegen/idegen. SH
Wait for a result similar to the following:
Read excludes:5mstraversed tree:44078ms
The ANDROID.IPR and ANDROID.IML two IntelliJ idea (as is based on IntelliJ Idea Community Edition) are generated in the root directory of the source code.
④ Open source root in as to the newly generated ANDROID.IPR
If as appears at import
It is recommended that the solution (URL: http://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit) be resolved according to its given resolution, as follows:
Iv. solve the problem of jumping error in source code
① set up the correct SDK and JDK for the current project
② setting ' Modules ' dependency
Delete all dependencies first, leaving only ' 1 ' pointing to the two (note: This is all just for convenience.) If you do use the. jar, add them to the path.
such as: 5.0.1 's Contactscommon used to Geocoder-2.9.jar and Libphonenumber-6.2.jar)
Click the ' + ' point in ' 2 ' and select ' 3 ' point to the ' Jars or directories ' option, then add the frameworks and external folders in turn. For example:
Other versions of the code may appear when adding frameworks:
No matter, just show the problem, click OK or the frameworks path will be added.
If you have a code jump error, follow the steps above to add the path or jar file of the code to its Dependencies tab.
Five, Debug source code
We can make it as an Android project by adding the ' Android Framework ' to the project we just imported in ' Modules ', which makes it easier for us to debug the code.
Android Framework support can be added as in ' 1 ' and ' 2 '.
Add a breakpoint in your code and select ' Run '--' Attach debugger to Android process ' or simply click on the icon shown
In the Choose Process dialog box, tick Show All processes, select the process where the code to debug is located, and click OK.
Vi. Other
There are many places in the code that prompt the call requires API level x.... This problem arises because as works for our project as an Android application, and Minsdkversion is not specified in the source code .
We just need to add a androidmanifest.xml file that declares minsdkversion to the root of the source (sharing a androidmanifest.xml).
you may also consider using Build.gradle to resolve the problem.
The file used in the text address: Http://yunpan.cn/cf3MBa2688eBw (extract code: 64E5)
How to develop/debug Android source using Android Studio