東川印記

一本東川,笑看爭龍斗虎;寰茫兦者,度橫佰昧人生。

android源码编译之07配置eclipse编写SystemService

2015年4月28日星期二



1,配置代码折叠插件Coffee Bytes Java
下载插件
地址:http://code.google.com/p/academic-cloud/downloads/list
具体的地址http://academic-cloud.googlecode.com/files/eclipse-folding- plugin.tar.gz
这个地址翻墙可下。
解压,放到eclipse下dropins里,
启动eclipse,Windows--Preferences--Java--Editor--Folding--Select folding to use.

应用以后,看起来是比默认的多了几个。

2,导入framework
①复制/home/senrsl/android/source/WORKING_DIRECTORY/development/ide /eclipse/.classpath到/home/senrsl/android/source/WORKING_DIRECTORY/目 录;
②修改.classpath,只保留framework需要的。
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <classpath>
  3.     <!--classpathentry kind="src" path="packages/apps/Bluetooth/src"/>
  4.     <classpathentry kind="src" path="packages/apps/Browser/src"/>
  5.     <classpathentry kind="src" path="packages/apps/Calendar/src"/>
  6.     <classpathentry kind="src" path="packages/apps/Calculator/src"/>
  7.     <classpathentry kind="src" path="packages/apps/Camera/src"/>
  8.     <classpathentry kind="src" path="packages/apps/CertInstaller/src"/>
  9.     <classpathentry kind="src" path="packages/apps/Contacts/src"/>
  10.     <classpathentry kind="src" path="packages/apps/DeskClock/src"/>
  11.     <classpathentry kind="src" path="packages/apps/Email/src"/>
  12.     <classpathentry kind="src" path="packages/apps/Email/emailcommon/src"/>
  13.     <classpathentry kind="src" path="packages/apps/Exchange/src"/>
  14.     <classpathentry kind="src" path="packages/apps/Gallery2/src"/>
  15.     <classpathentry kind="src" path="packages/apps/Gallery2/src_pd"/>
  16.     <classpathentry kind="src" path="packages/apps/Gallery2/gallerycommon/src"/>
  17.     <classpathentry kind="src" path="packages/apps/HTMLViewer/src"/>
  18.     <classpathentry kind="src" path="packages/apps/Launcher2/src"/>
  19.     <classpathentry kind="src" path="packages/apps/Mms/src"/>
  20.     <classpathentry kind="src" path="packages/apps/PackageInstaller/src"/>
  21.     <classpathentry kind="src" path="packages/apps/Phone/src"/>
  22.     <classpathentry kind="src" path="packages/apps/QuickSearchBox/src"/>
  23.     <classpathentry kind="src" path="packages/apps/Provision/src"/>
  24.     <classpathentry kind="src" path="packages/apps/Settings/src"/>
  25.     <classpathentry kind="src" path="packages/apps/SoundRecorder/src"/>
  26.     <classpathentry kind="src" path="packages/apps/Stk/src"/>
  27.     <classpathentry kind="src" path="packages/apps/VoiceDialer/src"/>
  28.     <classpathentry kind="src" path="packages/providers/CalendarProvider/src"/>
  29.     <classpathentry kind="src" path="packages/providers/ContactsProvider/src"/>
  30.     <classpathentry kind="src" path="packages/providers/DownloadProvider/src"/>
  31.     <classpathentry kind="src" path="packages/providers/DrmProvider/src"/>
  32.     <classpathentry kind="src" path="packages/providers/MediaProvider/src"/>
  33.     <classpathentry kind="src" path="packages/providers/TelephonyProvider/src"/-->
  34.     <classpathentry kind="src" path="frameworks/base/cmds/am/src"/>
  35.     <classpathentry kind="src" path="frameworks/base/cmds/input/src"/>
  36.     <classpathentry kind="src" path="frameworks/base/cmds/pm/src"/>
  37.     <classpathentry kind="src" path="frameworks/base/cmds/svc/src"/>
  38.     <classpathentry kind="src" path="frameworks/base/core/java"/>
  39.     <classpathentry kind="src" path="frameworks/base/drm/java"/>
  40.     <classpathentry kind="src" path="frameworks/base/graphics/java"/>
  41.     <classpathentry kind="src" path="frameworks/base/icu4j/java"/>
  42.     <classpathentry kind="src" path="frameworks/base/keystore/java"/>
  43.     <classpathentry kind="src" path="frameworks/base/location/java"/>
  44.     <classpathentry kind="src" path="frameworks/base/media/java"/>
  45.     <classpathentry kind="src" path="frameworks/base/obex"/>
  46.     <classpathentry kind="src" path="frameworks/base/opengl/java"/>
  47.     <classpathentry kind="src" path="frameworks/base/packages/SettingsProvider/src"/>
  48.     <classpathentry kind="src" path="frameworks/base/packages/SystemUI/src"/>
  49.     <classpathentry kind="src" path="frameworks/base/policy/src"/>
  50.     <classpathentry kind="src" path="frameworks/base/sax/java"/>
  51.     <classpathentry kind="src" path="frameworks/base/services/java"/>
  52.     <classpathentry kind="src" path="frameworks/base/telephony/java"/>
  53.     <classpathentry kind="src" path="frameworks/base/test-runner/src"/>
  54.     <classpathentry kind="src" path="frameworks/base/voip/java"/>
  55.     <classpathentry kind="src" path="frameworks/base/wifi/java"/>
  56.     <classpathentry kind="src" path="frameworks/ex/carousel/java"/>
  57.     <classpathentry kind="src" path="frameworks/ex/chips/src"/>
  58.     <classpathentry kind="src" path="frameworks/ex/common/java"/>
  59.     <classpathentry kind="src" path="frameworks/ex/variablespeed/src"/>
  60.     <classpathentry kind="src" path="frameworks/opt/calendar/src"/>
  61.     <classpathentry kind="src" path="frameworks/opt/vcard/java"/>
  62.     <classpathentry kind="src" path="frameworks/support/v13/java"/>
  63.     <!-- classpathentry kind="src" path="development/samples/ApiDemos/src"/>
  64.     <classpathentry kind="src" path="development/samples/ApiDemos/tests/src"/>
  65.     <classpathentry kind="src" path="development/samples/Compass/src"/>
  66.     <classpathentry kind="src" path="development/samples/HelloActivity/src"/>
  67.     <classpathentry kind="src" path="development/samples/HelloActivity/tests/src"/>
  68.     <classpathentry kind="src" path="development/samples/Home/src"/>
  69.     <classpathentry kind="src" path="development/samples/LunarLander/src"/>
  70.     <classpathentry kind="src" path="development/samples/LunarLander/tests/src"/>
  71.     <classpathentry kind="src" path="development/samples/NotePad/src"/>
  72.     <classpathentry kind="src" path="development/samples/NotePad/tests/src"/>
  73.     <classpathentry kind="src" path="development/samples/RSSReader/src"/>
  74.     <classpathentry kind="src" path="development/samples/SkeletonApp/src"/>
  75.     <classpathentry kind="src" path="development/samples/SkeletonApp/tests/src"/>
  76.     <classpathentry kind="src" path="development/samples/Snake/src"/>
  77.     <classpathentry kind="src" path="development/samples/Snake/tests/src"/-->
  78.     <classpathentry kind="src" path="libcore/dalvik/src/main/java"/>
  79.     <classpathentry kind="src" path="libcore/json/src/main/java"/>
  80.     <classpathentry kind="src" path="libcore/junit/src/main/java"/>
  81.     <classpathentry kind="src" path="libcore/luni/src/main/java"/>
  82.     <classpathentry kind="src" path="libcore/xml/src/main/java"/>
  83.     <!--classpathentry kind="src" path="out/target/common/obj/APPS/ApiDemos_intermediates/src/src"/>
  84.     <classpathentry kind="src" path="out/target/common/obj/APPS/Browser_intermediates/src/src"/>
  85.     <classpathentry kind="src" path="out/target/common/obj/APPS/CalendarProvider_intermediates/src/src"/>
  86.     <classpathentry kind="src" path="out/target/common/obj/APPS/ContactsProvider_intermediates/src/src"/>
  87.     <classpathentry kind="src" path="out/target/common/obj/APPS/MediaProvider_intermediates/src/src"/>
  88.     <classpathentry kind="src" path="out/target/common/obj/APPS/Music_intermediates/src/src"/>
  89.     <classpathentry kind="src" path="out/target/common/obj/APPS/Phone_intermediates/src/src"/>
  90.     <classpathentry kind="src" path="out/target/common/obj/APPS/QuickSearchBox_intermediates/src/src"/ -->
  91.     <classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/android-common-carousel_intermediates/src/renderscript/src"/>
  92.     <!-- classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/com.android.emailcommon_intermediates/src/src"/ -->
  93.     <classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java"/>
  94.     <classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/keystore/java"/>
  95.     <classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/location/java"/>
  96.     <classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java"/>
  97.     <classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java"/>
  98.     <classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/voip/java"/>
  99.     <classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/wifi/java"/>
  100.     <classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/services_intermediates/src"/>
  101.     <classpathentry kind="src" path="out/target/common/R"/>
  102.     <classpathentry kind="src" path="external/apache-http/src"/>
  103.     <classpathentry kind="src" path="external/bouncycastle/src/main/java"/>
  104.     <classpathentry kind="src" path="external/libphonenumber/java/src"/>
  105.     <classpathentry kind="src" path="external/nist-sip/java"/>
  106.     <classpathentry kind="src" path="external/tagsoup/src"/>
  107.     <classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/classes-jarjar.jar"/>
  108.     <!-- classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/javalib.jar"/ -->
  109.     <!--classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar"/-->
  110.     <!-- classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/gsf-client_intermediates/javalib.jar"/ -->
  111.     <classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.jar"/>
  112.     <!-- classpathentry kind="lib" path="packages/apps/Calculator/arity-2.1.2.jar"/ -->
  113.     <classpathentry kind="output" path="out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes"/>
  114. </classpath>
③eclipse目录下eclipse.ini加大内存
  1. -startup
  2. plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
  3. --launcher.library
  4. plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20120913-144807
  5. -product
  6. com.android.ide.eclipse.adt.package.adtproduct
  7. -showsplash
  8. org.eclipse.platform
  9. --launcher.XXMaxPermSize
  10. 256m
  11. --launcher.defaultAction
  12. openFile
  13. -vmargs
  14. -Dosgi.requiredJavaVersion=1.6
  15. -XX:MaxPermSize=256m
  16. -Xms512m
  17. -Xmx2048m
  18. -Dorg.eclipse.swt.browser.DefaultType=mozilla
④eclipse,Project--Build Auto,自动编译,不要。
⑤eclipse--File--New Java Project---填项目名,选路径,创建

等待导入。。。。
导入以后不要清理项目。。。。
⑥配置Debug运行
项目--右键--Debug As--Debug Config,选择Remote Java Application,新建

里面这个port来自于DDMS,打开DDMS,查看

就取到了8614端口,如果项目报一堆错误,不用管,直接Process是可以成功的


错误:
①导入后The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project
右键项目--属性--Java Build Path,里面没JRE,加上




现在看起来,就可以用eclipse编代码了,不用再折腾wine,vim什么的了。。。。。。


那些错误怎么解决呢。。。。。
把原版的.classpath放进去,然后重新走一遍,这样就把官方默认的都导进来了。
错误看起来少了好多,才五千多个嘛!!!

2015年04月28日20:56:48


--
senRsl
2015年04月28日18:50:56

没有评论 :

发表评论