I have Ubuntu 15.04 64 bit, Scala 2.11.6 and sbt 0.13.8.
I have android-sdk installed with at least android-22, and ANDROID_HOME set properly.
I followed the "Usage" section in android-sdk-plugin and did the following:
Created a fresh directory with the following files:
build.sbt:
lazy val root = (project in file (".")).
settings(
name := "Test",
version := "0.0.1",
scalaVersion := "2.11.6"
)
project/plugins.sbt:
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.4.1")
project/build.scala:
object Build extends android.AutoBuild
Ran sbt and got the following output:
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
[info] Loading global plugins from /home/pcn/.sbt/0.13/plugins
[info] Loading project definition from /home/pcn/Code/practice/test-scala-android/project
[info] Updating {file:/home/pcn/Code/practice/test-scala-android/project/}test-scala-android-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /home/pcn/Code/practice/test-scala-android/project/target/scala-2.10/sbt-0.13/classes...
[info] Set current project to Test (in build file:/home/pcn/Code/practice/test-scala-android/)
>
From sbt's promt, typed gen-android android-22 com.pcn.android.test Test and got the following output:
[info] Creating project: Test
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
Error: Project folder '.' is not empty. Please consider using 'android update' instead.
Created directory /home/pcn/Code/practice/test-scala-android/src/main/java
Created directory /home/pcn/Code/practice/test-scala-android/src/main/java/com/pcn/android/test
Added file ./src/main/java/com/pcn/android/test/MainActivity.java
Created directory /home/pcn/Code/practice/test-scala-android/src/androidTest/java
Created directory /home/pcn/Code/practice/test-scala-android/src/androidTest/java/com/pcn/android/test
Added file ./src/androidTest/java/com/pcn/android/test/MainActivityTest.java
Created directory /home/pcn/Code/practice/test-scala-android/src/main/res
Created directory /home/pcn/Code/practice/test-scala-android/src/main/res/values
Added file ./src/main/res/values/strings.xml
Created directory /home/pcn/Code/practice/test-scala-android/src/main/res/layout
Added file ./src/main/res/layout/main.xml
Created directory /home/pcn/Code/practice/test-scala-android/src/main/res/drawable-xhdpi
Created directory /home/pcn/Code/practice/test-scala-android/src/main/res/drawable-hdpi
Created directory /home/pcn/Code/practice/test-scala-android/src/main/res/drawable-mdpi
Created directory /home/pcn/Code/practice/test-scala-android/src/main/res/drawable-ldpi
Added file ./src/main/AndroidManifest.xml
Added file ./build.gradle
Created directory /home/pcn/Code/practice/test-scala-android/gradle/wrapper
[info] Creating SBT project files
>
From sbt's prompt, typed compile and got the following output:
[info] Updating {file:/home/pcn/Code/practice/test-scala-android/}root...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 1 Java source to /home/pcn/Code/practice/test-scala-android/target/scala-2.11/classes...
[error] /home/pcn/Code/practice/test-scala-android/src/main/java/com/pcn/android/test/MainActivity.java:3: package android.app does not exist
[error] android.app.Activity
[error] /home/pcn/Code/practice/test-scala-android/src/main/java/com/pcn/android/test/MainActivity.java:4: package android.os does not exist
[error] android.os.Bundle
[error] /home/pcn/Code/practice/test-scala-android/src/main/java/com/pcn/android/test/MainActivity.java:6: cannot find symbol
[error] symbol: class Activity
[error] Activity
[error] /home/pcn/Code/practice/test-scala-android/src/main/java/com/pcn/android/test/MainActivity.java:10: cannot find symbol
[error] symbol: class Bundle
[error] location: class com.pcn.android.test.MainActivity
[error] Bundle
[error] /home/pcn/Code/practice/test-scala-android/src/main/java/com/pcn/android/test/MainActivity.java:9: method does not override or implement a method from a supertype
[error] #Override
[error] /home/pcn/Code/practice/test-scala-android/src/main/java/com/pcn/android/test/MainActivity.java:12: cannot find symbol
[error] symbol: variable super
[error] location: class com.pcn.android.test.MainActivity
[error] super
[error] /home/pcn/Code/practice/test-scala-android/src/main/java/com/pcn/android/test/MainActivity.java:13: package R does not exist
[error] R.layout
[error] (compile:compileIncremental) javac returned nonzero exit code
[error] Total time: 0 s, completed Jun 19, 2015 1:18:50 AM
>
As we can see, for some reason it doesn't know about Activity and other Android classes. What did I do wrong and how do I fix it? I'm a complete noob with sbt so it's great if I can get detailed instructions.
Thanks.
PS: This is the content of my ~/.sbt/0.13/global.sbt, in case it's relevant:
scalacOptions ++= Seq("-deprecation", "-feature", "-optimize")
What you did in build.sbt confused AutoBuild. You can remove the project definition from build.sbt, or remove AutoBuild and apply androidBuild to the project manually.
Related
I've tried to create an MQTT project on Android by using PAHO.
According to the description, I clone the source code to my computer, and using
mvn clean install
to build the project.
I download org.eclipse.paho.mqtt.java-1.0.0, and expecting to get:
org.eclipse.paho.client.mqttv3-1.0.0.jar and
org.eclipse.paho.android.service-1.0.0.jar
but after running mvn clean install, I just can get org.eclipse.paho.client.mqttv3-1.0.0.jar, so I can't build the project.
and here is the message output:
C:\Users\Janniin\Downloads\org.eclipse.paho.mqtt.java-1.0.0\org.eclipse.paho.and roid.service>mvn install -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model fororg.eclipse.paho:android-service:jar:0.1
[WARNING] 'version' contains an expression but should be a constant. # org.eclipse.paho:java-parent:${paho.version}, C:\Users\Janniin\Downloads\org.eclipse.paho.mqtt.java-1.0.0\pom.xml, line 7, column 11
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. # line 95, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building android-service 0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- templating-maven-plugin:1.0-alpha-3:filter-sources (filter-src) # android-service ---
[INFO] Request to add 'C:\Users\Janniin\Downloads\org.eclipse.paho.mqtt.java-1.0.0\org.eclipse.paho.android.service\src\main\java-templates' folder. Not added since it does not exist.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # android-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Janniin\Downloads\org.eclipse.paho.mqtt.java-1.0.0\org.eclipse.paho.android.service\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3:compile (default-compile) # android-service ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-bundle-plugin:2.3.7:manifest (generate-manifest) # android-service ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.910 s
[INFO] Finished at: 2015-01-15T13:16:59+08:00
[INFO] Final Memory: 13M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.7:manifest (generate-manifest) on project android-service: Cannot find C:\Users\Janniin\
Downloads\org.eclipse.paho.mqtt.java-1.0.0\org.eclipse.paho.android.service\target\classes (manifest goal must be run after compile phase) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.7:manifest (generate-manifest) on projec
t android-service: Cannot find C:\Users\Janniin\Downloads\org.eclipse.paho.mqtt.java-1.0.0\org.eclipse.paho.android.service\target\classes (manifest goal must b
e run after compile phase)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot find C:\Users\Janniin\Downloads\org.eclipse.paho.mqtt.java-1.0.0\org.eclipse.paho.android.service\target\classes (manifest goal must be run after compile phase)
at org.apache.felix.bundleplugin.ManifestPlugin.execute(ManifestPlugin.java:73)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:264)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:255)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.io.FileNotFoundException: C:\Users\Janniin\Downloads\org.eclipse.paho.mqtt.java-1.0.0\org.eclipse.paho.android.service\target\classes
at org.apache.felix.bundleplugin.ManifestPlugin.getAnalyzer(ManifestPlugin.java:175)
at org.apache.felix.bundleplugin.ManifestPlugin.getManifest(ManifestPlugin.java:114)
at org.apache.felix.bundleplugin.ManifestPlugin.execute(ManifestPlugin.java:69)
... 23 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Could anyone give me some suggest to solve this problem??
Thx a lot!!
Have you tried following the information described here https://eclipse.org/paho/clients/java/ in order to build from source.
After running mvn package -DskipTests (it took some time) I got:
org.eclipse.paho.android.service-1.0.1.jar which is located under ..\org.eclipse.paho.mqtt.java\org.eclipse.paho.android.service\org.eclipse.paho.android.service\target
org.eclipse.paho.client.mqttv3-1.0.1.jar which is located under ..\org.eclipse.paho.mqtt.java\org.eclipse.paho.client.mqttv3\target
I'm building a Titanium Application for Android 2.2 Using Titanium SDK 2.0.1.GA2.
I can't resolve this error about TypeError: argument of type 'NoneType' is not iterable.
This is the Errors:
[ERROR] Exception occured while building Android project:
[ERROR] Traceback (most recent call last):
[ERROR] File "/home/owner/titanium_sdk/amd64/mobilesdk/linux/2.0.1.GA2/android/builder.py", line 2125, in <module>
[ERROR] s.build_and_run(True, avd_id, device_args=device_args)
[ERROR] File "/home/owner/titanium_sdk/amd64/mobilesdk/linux/2.0.1.GA2/android/builder.py", line 1973, in build_and_run
[ERROR] launched, launch_failed = self.package_and_deploy()
[ERROR] File "/home/owner/titanium_sdk/amd64/mobilesdk/linux/2.0.1.GA2/android/builder.py", line 1521, in package_and_deploy
[ERROR] output = run.run([zipalign, '-v', str(ALIGN_32_BIT), app_apk, app_apk+'z'])
[ERROR] File "/home/owner/titanium_sdk/amd64/mobilesdk/linux/2.0.1.GA2/android/run.py", line 30, in run
[ERROR] print "[DEBUG] %s" % (subprocess.list2cmdline(args))
[ERROR] File "/usr/lib/python2.7/subprocess.py", line 587, in list2cmdline
[ERROR] needquote = (" " in arg) or ("\t" in arg) or not arg
[ERROR] TypeError: argument of type 'NoneType' is not iterable
I don't use Titanium Studio and I execute builder.py directly for building application.
The application I want to build is created using Titanium SDK 2.0.1.GA2.
I already moved aapt, dx, lib in build-tools 17.0.0 into platform-tools.
This is my development emvironment:
OS: Debian 7 on VMWare Fusion 5.0.3
Python: Python 2.7.3
nodejs: v0.10.33
Java: OpenJDK 1.6
How do I build this one?
Thanks and best regards.
I am getting the following error while trying to make titanium build with 3.0.0.GA using ant scripting
[exec] [ERROR] Error(s) compiling generated Java code
[exec] [ERROR] D:\Workarea\experiment\teacher\digitallyTE\build\android\gen
\com\edurite\digiteacher\DigitallyteApplication.java:36: cannot find symbol [exec] symbol : class AssetCryptImpl [exec] location: class com.edurite.digiteacher.DigitallyteApplication [exec] KrollAssetHelper.setAssetCrypt(new AssetCryptImpl()) ; [exec] ^ [exec] Note: D:\Workarea\experiment\teacher\digitallyTE\build\android\gen\c om\edurite\digitallyTE\AssetCryptImpl.java uses unchecked or unsafe operations. [exec] Note: Recompile with -Xlint:unchecked for details. [exec] 1 error [exec]
BUILD FAILED D:\Workarea\experiment\teacher\build.xml:11: exec returned: 1
Quite a while ago that the question was asked. But I guess my findings could be interesting as a AssetCryptImpl.java:44: error: cannot find symbol error happened to me lastly. The AssetCryptImpl.java template is filled with some asset variables during the build (check ~/.titanium/mobilesdk/linux/6.1.0.GA/android/cli/commands/_build.js). This process depends at least on Linux on some system commands. Those commands failed with a Segmentation Fault during my builds. Thus the asset variables don't get rendered inside the AssetCryptImpl.java template and the Java compiler will complain about missing symbols.
Check your build output for a line like
[INFO] : Encrypting JavaScript files: /home/simon/.titanium/mobilesdk/linux/6.1.0.GA/android/titanium_prep.linux64 "com.example.id" "/home/simon/test/Asdf/build/android/assets" "alloy/CFG.js" "app.js" "alloy/backbone.js" "alloy/constants.js" "alloy/controllers/BaseController.js" "alloy/controllers/index.js" "alloy/styles/index.js" "alloy/sync/localStorage.js" "alloy/sync/properties.js" "alloy/sync/sql.js" "alloy/underscore.js" "alloy/widget.js" "alloy.js" "ti.cloud/ti.cloud.js" "_app_props_.json"
and try to run the included command.
I can't build Android + Scala (and IntelliJ Idea 12) project using sbt and sbt-android plugin. I installed everything needed and added ANDROID_SDK_HOME to both .bashrc and /etc/profile but:
me123#ubuntu:~/Documents/android_projects/my-android-project$ echo $ANDROID_SDK_HOME
/home/me123/android-sdk-linux/sdk
me123#ubuntu:~/Documents/android_projects/my-android-project$ sudo echo $ANDROID_SDK_HOME
/home/me123/android-sdk-linux/sdk
me123#ubuntu:~/Documents/android_projects/my-android-project$ sbt
[info] Loading global plugins from /home/me123/.sbt/plugins
[info] Loading project definition from /home/me123/Documents/android_projects/my-android-project/project
[info] Compiling 3 Scala sources to /home/me123/Documents/android_projects/my-android-project/project/target/scala-2.9.2/sbt-0.12/classes...
[error] /home/me123/Documents/android_projects/my-android-project/project/target/scala-2.9.2/sbt-0.12/classes/AndroidEclipse$Transformer.class (Permission denied)
[error] one error found
[error] (compile:compile) Compilation failed
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q
me123#ubuntu:~/Documents/android_projects/my-android-project$ sudo sbt
[info] Loading project definition from /home/me123/Documents/android_projects/my-android-project/project
[info] Updating {file:/home/me123/Documents/android_projects/my-android-project/project/}default-6ff5da...
[info] Resolving org.scala-sbt#precompiled-2_10_0;0.12.2 ...
[info] Done updating.
[error] Android SDK not found. You might need to set ANDROID_SDK_HOME or ANDROID_SDK_ROOT or ANDROID_HOME
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q
UPDATE:
> android:start-device
[info] Wrote /home/alex/Documents/android_projects/my-android-project/target/scala-2.10/src_managed/main/scala/my/android/project/TR.scala
[info] Compiling 2 Scala sources and 1 Java source to /home/alex/Documents/android_projects/my-android-project/target/scala-2.10/classes...
[warn] there were 4 feature warnings; re-run with -feature for details
[warn] one warning found
ProGuard, version 4.6
ProGuard is released under the GNU General Public License. You therefore
must ensure that programs that link to it (scala, ...)
carry the GNU General Public License as well. Alternatively, you can
apply for an exception with the author of ProGuard.
Reading program directory [/home/alex/Documents/android_projects/my-android-project/target/scala-2.10/classes]
[trace] Stack trace suppressed: run last main/android:proguard for the full output.
[error] (main/android:proguard) java.io.IOException: Can't read [/home/alex/Documents/android_projects/my-android-project/target/scala-2.10/classes] (Can't process class [my/android/project/R$id.class] (Unsupported version number [51.0] for class format))
[error] Total time: 14 s, completed May 30, 2013 3:49:46 PM
First, doing sudo echo $ANDROID_HOME will be exactly the same as echo $ANDROID_HOME, because the variable will be replaced by your shell before executing the command.
Then, you most likely have a permission problem. Try running this to make sure you have the right ones :
$ chmod -Rv 700 /home/me123/Documents/android_projects/my-android-project/
I'm trying to use the android bootstrap : https://github.com/donnfelker/android-bootstrap.
I clone the code.but when
So i try the next command from the app directory :
mvn clean package
but get Something wrong.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project android-bootstrap: Compilation failure: Compilation failure:
[ERROR] \Users\keepcleargas\android-bootstrap\app\src\main\java\com\donnfelker\android\bootstrap\BootstrapModule.java:[33,8] Error: can not find symbol
[ERROR] \Users\keepcleargas\android-bootstrap\app\src\main\java\com\donnfelker\android\bootstrap\BootstrapModule.java:[33,22] The error: <none> initialization procedure is illegal.
can't recognize the symbol 'entryPoints'.
#Module
(
complete = false,
entryPoints= {
BootstrapApplication.class,
BootstrapAuthenticatorActivity.class,
CarouselActivity.class,
BootstrapTimerActivity.class,
CheckInsListFragment.class,
NewsActivity.class,
NewsListFragment.class,
UserActivity.class,
UserListFragment.class,
TimerService.class
}
)
The symbol entryPoints has been renamed to to injects.
See discussion here: https://github.com/donnfelker/android-bootstrap/issues/44