Emacs uses JDEE to write Android programs

Source: Internet
Author: User

The previous section describes how to use Maven to build an Android project and how to use JDEE to write programs.

Ubuntu 14.04 Android uses Maven 2 to create its own Maven Project

For how to install JDEE, refer to the previous article:

Configure JDEE in Emacs 24.3

First, install an m2jdee plug-in to generate the prj. el file required by jdee Based on the configuration in maven pom. xml.

Obtain the project:

git clone git@gitlab.com:devtool/m2jdee.git
git clone https://gitlab.com/devtool/m2jdee.git
mvn install
  <pluginGroups>    <pluginGroup>org.freebird.maven.plugins</pluginGroup>  </pluginGroups>
mvn m2jdee:jdee
(jde-project-file-version "1.0")(jde-set-variables  '(jde-sourcepath '("/home/dean/work/gitlab_cloud/android/example/mvn_example1/src/test/java" "/home/dean/work/gitlab_cloud/android/example/mvn_example1/src" ))  '(jde-global-classpath '("/home/dean/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar" "/home/dean/.m2/repository/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar" "/home/dean/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar" "/home/dean/work/gitlab_cloud/android/example/mvn_example1/target/test-classes" "/home/dean/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" "/home/dean/work/gitlab_cloud/android/example/mvn_example1/target/classes" "/home/dean/.m2/repository/org/khronos/opengl-api/gl1.1-android-2.1_r1/opengl-api-gl1.1-android-2.1_r1.jar" "/home/dean/.m2/repository/com/google/android/android/4.1.1.4/android-4.1.1.4.jar" "/home/dean/.m2/repository/org/json/json/20080701/json-20080701.jar" "/home/dean/.m2/repository/xpp3/xpp3/1.1.4c/xpp3-1.1.4c.jar" "/home/dean/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar" )))

C-c v.

The complete menu appears.

Configuration successful.

For more information, see my previous article:

Use of Emacs for Java Development

How to debug

First in ~ /. Emacs. d/init. el. Set jdb as the debugger and debug port as 8700.

;; jdee(add-to-list 'load-path "~/.emacs.d/jdee-2.4.1/lisp")(load "jde")(custom-set-variables '(jde-debugger (quote ("jdb"))) '(jde-db-option-connect-socket (quote (nil "8700"))))(require 'android-mode)(setq android-mode-sdk-dir "/opt/android-sdk-linux/")

Start

Andriod-start-emulator

Android-start-ddms

Be sure to select the process to be debugged in the DDM window

Commands used for debugging

Mvn_example1 $ jdb-sourcepath "/home/dean/work/gitlab_cloud/android/example/mvn_example1/src"-attach localhost: 8700 set javamvn_example1 $ jdb-sourcepath "/home/dean/work/gitlab_cloud/android/example/mvn_example1/src"-attach localhost: 8700 set not to capture java. lang. throwable sets the delayed uncaptured java. lang. throwable is initializing jdb .... lang. throwable sets the delayed uncaptured java. lang. throwable is initializing jdb...
The jdee jde-jdb-attach-via-socket command is as follows:

Jdb-connect com. sun. jdi. SocketAttach: port = 8700

Unable to connect to the jvm in android.

After the experiment, you need to add a parameter to connect:

Jdb-connect com. sun. jdi. SocketAttach: port = 8700, hostname = localhost

Therefore, modify the jdee configuration as follows in init. el:

;; jdee(add-to-list 'load-path "~/.emacs.d/jdee-2.4.1/lisp")(load "jde")(custom-set-variables '(jde-db-option-connect-socket (quote ("localhost" "8700"))) '(jde-debugger (quote ("jdb"))))

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.