Public activity at https://sr.ht/~rwv/
remvee / android-mode Goto Github PK
View Code? Open in Web Editor NEWEmacs minor mode for Android application development
License: GNU General Public License v3.0
Emacs minor mode for Android application development
License: GNU General Public License v3.0
Public activity at https://sr.ht/~rwv/
android-mode does not seem to locate the build.gradle file in the root of a project created with android create project
with the -g
option, and the builder gets set-up for ant
regardless. Also, as a result, the SDK is not setup properly (I don't have ANDROID_HOME exported in my .zshrc).
I've tried this:
(setq android-mode-sdk-dir "/Users/uri/Library/Android/sdk"
android-mode-builder "gradle")))
Which made some things work (launching the emulator etc.) but I can't compile and keep seeing this error message "gradle was not found in `android-mode-root-file-plist' ".
android-mode-root-file-plist
is setup as (ant "AndroidManifest.xml" maven "AndroidManifest.xml" gradle "build.gradle")
Allow passing of options to the emulator (ie --skin or --scale)
Looking at the newest Android 26 sdk installed on my system, it looks like create
is no longer a valid option for the android
program installed. Furthermore, it appears the android
program is now deprecated.
The official documentation states:
This tool is no longer supported. Instead use Android Studio to create AVDs and create projects, or use sdkmanager to view and install SDK packages from the command line.
https://developer.android.com/studio/tools/help/android.html
Is there a plan to change android-mode
given the depracated state of some of the tools?
Hi
If case-fold-search is t, which is my condition, there is a case that
android-project-main-activities does not work.
When value of android:name at activity in AndroidManifest.xml is fully
qualified name like [package].[activity], I cannot start activity.
<path-to-sdk>/platform-tools/adb shell am start -n
com.me.helloworld/com.me.helloworld.com.me.helloworld.MainActivity
Starting: Intent {
cmp=com.me.helloworld/.com.me.helloworld.MainActivity }^M
Error type 3^M
Error: Activity class
{com.me.helloworld/com.me.helloworld.com.me.helloworld.MainActivity}
does not exist.^M
When not fully qualified name like .[activity] or [activity], I can
start activity.
Starting activity: com.me.helloworld.MainActivity
For avoiding this, I think that android-project-main-activities should
care case-fold-search like android-current-buffer-class-name.
diff --git a/android-mode.el b/android-mode.el
index f7959c6..747dfab 100644
--- a/android-mode.el
+++ b/android-mode.el
@@ -362,7 +362,8 @@ Filter on CATEGORY intent when supplied."
(package (xml-get-attribute root 'package))
(application (first-xml-child root 'application)))
(mapcar (lambda (activity)
- (let ((name (xml-get-attribute activity 'android:name)))
+ (let ((case-fold-search nil)
+ (name (xml-get-attribute activity 'android:name)))
(cond ((string-match "^\\." name) (concat package name))
((string-match "^[A-Z]" name) (concat package "." name))
(t name))))
I got this error after I entering path, package, activity inputs. I correctly entered andorid-sdk path.
How can I solve this problem?
Thanks
M-x android-build-reinstall
Symbol's function definition is void: android-ant-reinstall
Reproduce:
(Java installed, android sdk install, emulator started via command line)
Install android-mode.el
Open file inside an android project ;;fails with above command
run any android command (android-start-emulator) ;;fails with above command
Help just with debugging this would be great, I am a EMACS mode/lisp novice.
A clean task would be nice. Here is a patch for it:
diff --git a/android-mode.el b/android-mode.el
index dac9fc9..3e9487b 100644
--- a/android-mode.el
+++ b/android-mode.el
@@ -120,6 +120,7 @@
(interactive)
(android-ant ,task)))
+(android-defun-ant-task "clean")
(android-defun-ant-task "compile")
(android-defun-ant-task "install")
(android-defun-ant-task "reinstall")
@@ -129,6 +130,7 @@
'(("d" . android-start-ddms)
("e" . android-start-emulator)
("l" . android-logcat)
I use emacs 24.4 on windows 8.1.
when M-x android-create-project ,I got this error:
Making completion list...
if: Error: Argument 'com.test.hello' is not recognized.
Usage:
android [global options] create project [action options]
Global options:
-s --silent : Silent mode, shows errors only.
-v --verbose : Verbose mode, shows errors, warnings and all messages.
--clear-cache: Clear the SDK Manager repository manifest cache.
-h --help : Help on a specific command.
Action "create project":
Creates a new Android project.
Options:
-n --name : Project name.
-a --activity : Name of the default Activity that is created.
[required]
-k --package : Android package name for the application. [required]
-v --gradle-version: Gradle Android plugin version.
-t --target : Target ID of the new project. [required]
-g --gradle : Use gradle template.
-p --path : The new project's directory. [required]
After I modify android-create-project:
; (command (format "%s create project --path %S --package %s --activity %s --target %S"
==>
(command (format "%s create project --path %s --package %s --activity %s --target %s"
It work okใ
I seem to now be getting an error after the last merge for maven support.
If I run:
$ emacs -batch -Q -f batch-byte-compile *.el
I get the following error:
In toplevel form:
android-mode.el:421:1:Error: Symbol's value as variable is void: android-mode-build-command-alist
I had to patch this a bit to work on win32 since it had issues with pathing:
(defun android-start-emulator ()
"Launch Android emulator."
(interactive)
(let ((avd (or (and (not (string= android-mode-avd "")) android-mode-avd)
(completing-read "Android Virtual Device: " (android-list-avd)))))
(unless (android-start-exclusive-command (concat "android-emulator-" avd "") (concat (shell-quote-argument (concat android-mode-sdk-dir "/tools/emulator")) " -avd " avd))
(message (concat "emulator " avd " already running")))))
(defun android-list-avd ()
"List of Android Virtual Devices installed on local machine."
(let* ((command (concat (shell-quote-argument (concat android-mode-sdk-dir "/tools/android")) " list avd"))
(output (shell-command-to-string command))
(result nil)
(offset 0))
(while (string-match "Name: (.*)" output offset)
(setq result (cons (match-string 1 output) result))
(setq offset (match-end 0)))
(if result
(reverse result)
(error "no Android Virtual Devices found"))))
Sorry I havent provided a diff, I dont have git on this machine yet
I'm running Emacs 23. Is this a custom function not included?
"ant compile" is no longer available.
And ant install now requires ant debug install or ant release install.
They seem to have removed the reinstall target. Since you can't kill processes in android, if I've already started my app in the emulator, I don't see any way to get it to refresh to the new version after I install the app again (I assume this was what reinstall did for you).
I get the following stacktrace whenever running android-ant tasks:
Debugger entered--Lisp error: (wrong-number-of-arguments (lambda (buffer) (let ((frame (dolist (item (frame-list)) (if (string-match "<1>" (frame-parameter item (quote title))) (return item))))) (set-window-buffer (frame-selected-window frame) buffer) (frame-selected-window frame))) 2)
existing-frame-popup(#<buffer *compilation*> nil)
funcall(existing-frame-popup #<buffer *compilation*> nil)
(lambda (buffer _alist) (funcall special-display-function buffer (quote nil)))(#<buffer *compilation*> nil)
display-buffer(#<buffer *compilation*>)
compilation-start("ant debug" nil)
compile("ant debug")
android-ant("debug")
android-ant-debug()
call-interactively(android-ant-debug t nil)
execute-extended-command(nil)
call-interactively(execute-extended-command nil nil)
I haven't been able to figure out where exactly this is coming from, what this code is trying to do, where it is located (somewhere deep in compile.el?) and what's causing it to fail.
This is on GNU Emacs 24.1.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-07-25.
I get the same error using the marmalade android-mode and the latest git master android-mode.el.
android create project
excepts a -g
flag to create a gradle project. The option to use this flag should be included in android-create-project
.
just forked this mode and changed little bit code make it working with mvn. found 2 small issues
logcat nothing show on android-logcat-buffer
android-mode:263 , (replace-regexp-in-string "^M" "" output))
start-app C-c C-c a , if I defined the activity in AndroidManifest.xml as ".activity.MyActivity" this command not works
android-mode: ~373 should change "/." to
(cond
((string-equal "." (substring (android-launcher-activity) 0 1)) "/")
(t "/."))
just put these code snippets here , because I changed the mode working with mvn, if you want a pull-request any way, let'me know .
Hi
I'm enjoying android-mode.el. This elisp package is useful for me.
But I'm not sure about android-start-app (C-c C-c a).
When I use android-start-app, below error is happened and I cannot
start my application.
Symbol's function definition is void: first-xml-child
When changing cl-flet to flet in android-mode.el as below, message is
not happened and I can start my application.
diff --git a/android-mode.el b/android-mode.el
index 364fd8f..a998884 100644
--- a/android-mode.el
+++ b/android-mode.el
@@ -344,7 +344,7 @@ the project package name.
Filter on CATEGORY intent when supplied."
(android-in-root
- (cl-flet ((first-xml-child (parent name)
+ (flet ((first-xml-child (parent name)
(car (xml-get-children parent name)))
(action-main-p (activity)
(let ((el (first-xml-child
(first-xml-child activity
When compiling android-mode.el with M-x byte-compile-file, below
warning is shown.
android-mode.el:449:1:Warning: the function `first-xml-child' is not known to be defined.
cl-flet may be more strictly than flet. flet may ignore
first-xml-child issue.
I tried GNU Emacs 24.3.1 on Mac and GNU Emacs 24.3.1 on
ubuntu 12.04.
What elisp package should I install for using first-xml-child ?
I have a project with the following layout:
./gradew
./gradle/
./projectFiles
./MyActualProjectDir/src/main/AndroidManifest.xml
All my gradle commands have to be launched from the root dir so the root dir is set at the top level. This works for building the project.
However when I try to launch it with android-start-app, it is looking for the manifest in the top dir and it does not find it.
Would it be possible to separate android-root-dir from the place the manifest is ?
Thanks
SDK android.el file already contains code to enable JDB debugging.
Would it be possible to enhance this mode or theirs applying differences between them? SDK android.el could be reinvigorated with your code, or your code would be more complete with SDK android.el
android-mode-sdk-dir is a variable defined in `android-mode.el'.
Its value is "~/Android/sdk"
Original value was
(getenv ANDROID_HOME)
Something changes the variable from the correct string (ANDROID_HOME, set by (exec-path-from-shell-copy-env "ANDROID_HOME")), to the default value.
I am using magit and when I require android-mode
the magit-commit-buffer bindings are overwritten. I would suggest removing the built-in hooks and let the user create the hooks according to their setup.
https://github.com/remvee/android-mode/blob/master/android-mode.el#L93 incorrectly calls android-local-sdk-dir as android-mode-local-sdk-dir.
It would be nice if I could add options for the emulator when it starts up, such as enabling the kvm. As such, this is a feature request for android-mode.el#L226, and (android-start-emulator) as a whole, to handle free-form arguments to the emulator.
I'd attach a patch, but I don't currently have the time to do so. If you'd like a patch I can has one up in about a week or so and attach it here.
The android-start-emulator prompt for an AVD even when none have been configured. Issue a warning message instead.
I found a command to run an application in the AVD from a shell :
adb shell monkey -v -p com.essais.hello 1
What about adding an emacs command doing this :
M-x android-ant-install
and then executing this shell command automatically ?
Compiling file /home/crane/.emacs.d/elpa/android-mode-0.3.0/android-mode-pkg.el at Fri Nov 7 15:37:30 2014
Entering directory `/home/crane/.emacs.d/elpa/android-mode-0.3.0/'
Compiling file /home/crane/.emacs.d/elpa/android-mode-0.3.0/android-mode.el at Fri Nov 7 15:37:30 2014
android-mode.el:96:1:Error: Symbol's value as variable is void: android-mode-default-builders
Problem:
With "android-create-project" I get "android-tool-path: can't find SDK tool: android"
Config:
Also tried with "android-mode-master" downloaded from this site. I get the same error.
Any idea?
One of the consequences of the current structure is that when the builder variable is set to a symbol other than one of the three explicitly supported builders most android-mode
commands fail with poor error messages.
I think the "best" thing to do might be to rework the way that commands are created for the specific builders or how the key-binding functions are created. Not sure which is better...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.