scala-android / sbt-android Goto Github PK
View Code? Open in Web Editor NEWAn easy-to-use sbt plugin for working with all Android projects
License: Other
An easy-to-use sbt plugin for working with all Android projects
License: Other
I run a genymotion virtual device. It has a hostname as ip:port form.
That is, when I type devices
in sbt console:
> devices
[info] Connected devices:
[info] 192.168.56.102:5555 vbox86p
Then, when I run android:install
I get the error:
java.lang.RuntimeException: Could not create directory C:\path\to\my\project\target\scala-2.10\cache\android\global\install-192.168.56.102:5555
This looks like because of windows filesystem does not allow colon in file name.
Please escape colons with other substring such as _colon_
.
It would be great to have some basic integration with the NDK build process. Right now every time I change the library, I must clean and rebuild the project to add the correct native code to the APK.
I'm creating this issue to collect some information on how/where in the code It should be done.
You mention in your TODO that you still need to deploy somewhere the avoid the publish-local
step. Any chance to expedite that?
http://www.scala-sbt.org/community-plugins.html#communityrepo
I'd really like to use sbt for this project I'm working on but I need something that anyone can use without an additional step.
When I create ordinary FunSpecs under src/test/scala, sbt can't find them. Running ./sbt test says that it ran 0 tests. The issue is also documented here: http://stackoverflow.com/questions/22626485/using-scalatest-with-sbt-android-sdk-plugin
It seems that android-sbt-plugin sets the test path to src/instrumentTest. I'd just like to run plain old Unit tests and really don't care about running them on android at this point.
I'm using the current version of android-sbt-plugin: 1.2.11
Description in README is duplicated:
https://github.com/pfn/android-sdk-plugin#description
https://github.com/pfn/android-sdk-plugin#description-1
Regards,
Kamol
I'm just starting with Android and I've created a most basic multiproject configuration with base subproject, android subproject dependent on base and aggregating root meta-project.
Here's my Build.scala: https://github.com/daydev/hello-android/blob/master/project/Build.scala
Everything compiles fine, but when I try to do something android with it (android:run, for example) I get the following error:
(hello-android-droid/android:proguardInputs) java.io.FileNotFoundException: ~/bin/projects/android/HelloAndroid/core/target/scala-2.10/classes (Is a directory)
As I understand it, proguardInputs looks for classes.jar to do it's magic, but finds directory instead, and crashes.
What should I config to make proguard/proguardInputs work with directory or how should I config compile/package task for core subproject to make proguard happy?
Hi,
I got an error while configuring my android project with your plugin (which is awesome (your plugin))
but with in-app billing I get the following error:
object vending is not member of package com.android
am I missing a library configuration? It works in eclipse like a charm.
Thank you !
Hi,
com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE.txt
File 1: C:\Users\stanch\.ivy2\cache\joda-time\joda-time\jars\joda-time-2.2.jar
File 2: C:\Users\stanch\.ivy2\cache\joda-time\joda-time\jars\joda-time-2.2.jar
Would be nice to have an option like Gradle has:
android.packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
or, more recently:
android.packagingOptions {
pickFirst 'META-INF/services/javax.ws.rs.ext.MessageBodyReader'
}
My project works well with sbt 2.12.4.
However, when I upgraded sbt to 2.13.0, running sbt produces following error:
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
at jline.TerminalFactory.create(TerminalFactory.java:101)
at jline.TerminalFactory.get(TerminalFactory.java:159)
at sbt.JLine$.sbt$JLine$$terminal(LineReader.scala:87)
at sbt.JLine$.withTerminal(LineReader.scala:91)
at sbt.JLine$.usingTerminal(LineReader.scala:97)
at sbt.JLine$.createReader(LineReader.scala:103)
at sbt.FullReader.<init>(LineReader.scala:135)
at sbt.BasicCommands$$anonfun$shell$1.apply(BasicCommands.scala:131)
at sbt.BasicCommands$$anonfun$shell$1.apply(BasicCommands.scala:128)
at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:31)
at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:31)
at sbt.Command$.process(Command.scala:95)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:87)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:87)
at sbt.State$$anon$1.process(State.scala:176)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:87)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:87)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.MainLoop$.next(MainLoop.scala:87)
at sbt.MainLoop$.run(MainLoop.scala:80)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:69)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:66)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runWithNewLog(MainLoop.scala:66)
at sbt.MainLoop$.runAndClearLast(MainLoop.scala:49)
at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:33)
at sbt.MainLoop$.runLogged(MainLoop.scala:25)
at sbt.xMain.run(Main.scala:26)
at xsbt.boot.Launch$.run(Launch.scala:55)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:69)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:31)
at xsbt.boot.Boot$.main(Boot.scala:20)
at xsbt.boot.Boot.main(Boot.scala)
at SbtJansiLaunch.main(SbtJansiLaunch.java:4)
[error] java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
[error] Use 'last' for the full log.
The android.jar
should be present in the Test classpath as it contains classes that are not in the Scala/Java libraries.
For example, if the program uses classes from org.json.*
then this code cannot be tested on the computer.
There is perhaps a simple workaround?
If scala libs are preinstalled on android device the proguard step of the build is unneccesary. How can i disable that step?
When developing I have the scala library pre-installed on the device and use the uses-library declaration in AndroidManifest.xml.
When building the apk in release mode (with proguard) I need to remove the uses-library declarations from AndroidManifest. It would be nice if android-sdk-plugin would do this automatically in release mode.
Hi,
Your plugin is awesome but sometimes, without any reason it doesn't work.
Sometimes, when I launch the compilation, I get a crash from SBT telling me that I have more than 65K methods.
Then I type clean in the console, retry and it just works. Next compilation works, and so on for several hours, and for no obvious reason, the same error comes back. I make no modification to the sbt file or anything like this. It just kind of random (or there is a cause I have not yet found).
Moreover I have a huge proguard file. I know it s applied automatically (when proguard is used) because otherwise I would get lots of warnings.
Here is my plugin sbt file
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.2.2")
addSbtPlugin("com.hanhuy.sbt" % "sbt-idea" % "1.6.0")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.2")
and here is my build.sbt file
// so we can use keywords from Android, such as 'Android' and 'proguardOptions'
import android.Keys._
import android.Dependencies.{aar,apklib}
// load the android plugin into the build
android.Plugin.androidBuild
// project name, completely optional
name := "OBackup"
// pick the version of scala you want to use
scalaVersion := "2.10.2"
// scala 2.10 flag for feature warnings
scalacOptions in Compile += "-feature"
// for non-ant-based projects, you'll need this for the specific build target:
platformTarget in Android := "android-19"
resolvers ++= Seq("Bugsense repository" at "http://www.bugsense.com/gradle/",
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
"Mandubian repository snapshots" at "https://github.com/mandubian/mandubian-mvn/raw/master/snapshots/",
"Mandubian repository releases" at "https://github.com/mandubian/mandubian-mvn/raw/master/releases/"
)
libraryDependencies ++= Seq (
"org.scaloid" %% "scaloid" % "latest.integration",
"com.netflix.rxjava" % "rxjava-core" % "latest.integration",
"com.netflix.rxjava" % "rxjava-scala" % "latest.integration" intransitive(),
"com.netflix.rxjava" % "rxjava-android" % "latest.integration" intransitive(),
"com.android.support" % "support-v4" % "19.0.0",
"com.google.code.gson" % "gson" % "latest.integration",
"org.joda" % "joda-convert" % "1.5",
"joda-time" % "joda-time" % "2.3",
"com.googlecode.json-simple" % "json-simple" % "1.1" intransitive(),
"de.keyboardsurfer.android.widget" % "crouton" % "latest.integration" intransitive(),
"com.bugsense.trace" % "bugsense" % "3.5",
"com.google.android.gms" % "play-services" % "latest.integration" intransitive(),
"com.google.apis" % "google-api-services-drive" % "latest.integration" intransitive(),
"com.google.api-client" % "google-api-client" % "latest.integration" intransitive(),
"com.google.api-client" % "google-api-client-android" % "latest.integration" intransitive(),
"com.google.http-client" % "google-http-client-jackson" % "latest.integration" intransitive(),
"com.google.http-client" % "google-http-client-gson" % "latest.integration" intransitive(),
"com.typesafe.play" %% "play-json" % "2.2.0"
)
ideaExcludeFolders ++= Seq (
".idea",
".idea_modules",
"target",
"project"
)
proguardCache in Android ++= Seq(
ProguardCache("org.scaloid") % "org.scaloid" %% "scaloid",
ProguardCache("rx") % "com.netflix.rxjava" %% "rxjava-core",
ProguardCache("rx") % "com.netflix.rxjava" %% "rxjava-scala",
ProguardCache("rx") % "com.netflix.rxjava" %% "rxjava-android",
ProguardCache("play") % "play" %% "play-json"
)
// call install and run without having to prefix with android:
run <<= run in Android
install <<= install in Android
Do you have an idea about the reason?
Regards
I have a build with one library project and two normal Android projects that depend on the library project.
The two normal projects don't include any code, but just have their own AndroidManifest.xml for generating slightly different versions of the app. The library project contains many scala classes.
Now the problem is that when installing the two projects, proguard is not used automatically and the scala library is not included in the dex file.
The problem seems to be that there are no scala files in projects, but only in the library project. If I create dummy scala files in the projects, then everything works.
For fixing this, it should not only be checked if there are scala files in the current project, but only if there are scala files in any generated library projects (or, perhaps, in other used libraries).
Should proguardOptions
be defined as a SettingsKey
rather than a TaskKey
? My android:proguardOptions
stays empty when queries from sbt.
Consider something like:
(dependencyClasspath in Test) -- (dependencyClasspath in Compile)
must toList and remove classes.jar from the test apk
It seems to me that the proguard cache is not used correctly in the plug-in.
If I generate my app with clean and then android:install, then everything works ok. Proguard is executed, the app is installed and runs without problems.
However, if I leave out the clean and I don't change any code (e.g. I just change something in xml files), then proguard is not executed again, but the dex file is regenerated nevertheless without using proguard and apparently without including the scala library.
This is the output:
[info] [debug] cache hit, skipping proguard!
[info] [debug] Forcing clean dex
[info] Generating classes.dex
[info] Packaged: guidemate-debug-unaligned.apk (2,64MB)
[info] Debug package does not need signing: guidemate-debug-unaligned.apk
[info] zipaligned: guidemate-debug.apk
[info] Installing...
[info] [guidemate-debug.apk] Install finished: 2,64MB in 17,17s. 157,37KB/s
In tasks.scala (proguardTaskDef), there is this part:
if (inputs.proguardCache exists (_.exists)) {
s.log.info("[debug] cache hit, skipping proguard!")
None
}
I think the problem could be that None is returned here instead of the cached jar file.
Ok, I hope this time it’s a genuine one :)
I’m getting
[warn] UNEXPECTED TOP-LEVEL EXCEPTION:
[warn] java.lang.IllegalArgumentException: already added: Lscala/reflect/api/Liftable$;
I have added
ProguardCache("scala.reflect") % "org.scalamacros"
However this does not help. There might be something fishy going on here, because the M6
version of macro-paradise injects reflect.api.Liftable
and some other classes in a perculiar way. Maybe @xeno-by could share the details?
Hi,
I’m trying your plugin on the Macroid sample project: https://github.com/stanch/macroid-starter
Here’s my build.sbt: https://github.com/stanch/macroid-starter/blob/master/build.sbt
When android:run
is performed for the first time, everything is fine. However, on subsequent invocations this is what happens:
[trace] Stack trace suppressed: run last android:dex for the full output.
[error] (android:dex) com.android.ide.common.internal.LoggedErrorException: Failed to run command:
[error] C:\Progra~2\Android\android-sdk\build-tools\17.0.0\dx.bat -JXmx1024m --dex --incremental --no-strict --output C:\projects\macroid-starter\target\android-bin\classes.d
ex C:\Users\stanch\.ivy2\cache\com.android.support\support-v13\jars\support-v13-13.0.0.jar C:\Users\stanch\.ivy2\cache\com.scalarx\scalarx_2.10\jars\scalarx_2.10-0.1.jar C:\Users\sta
nch\.ivy2\cache\com.typesafe.akka\akka-actor_2.10\bundles\akka-actor_2.10-2.1.2.jar C:\Users\stanch\.ivy2\cache\io.dylemma\scala-frp_2.10\jars\scala-frp_2.10-1.0.jar C:\Users\stanch\
.ivy2\cache\org.scalaz\scalaz-core_2.10\bundles\scalaz-core_2.10-7.0.3.jar C:\projects\macroid-starter\target\android-bin\classes.jar C:\Users\stanch\.ivy2\cache\com.typesafe\config\
bundles\config-1.0.0.jar C:\Users\stanch\.ivy2\cache\com.android.support\support-v4\jars\support-v4-13.0.0.jar C:\projects\macroid-starter\target\scala-2.10\cache\default-42a471\glob
al\proguard_cache\proguard-cache-cdb4ee70ce1e1c206e16ebf6f9bc6f5db317c704.jar
[error] Error Code:
[error] 1
[error] Output:
[error]
[error] UNEXPECTED TOP-LEVEL EXCEPTION:
[error] java.lang.IllegalArgumentException: already added: Lorg/macroid/starter/MainActivity$$anon$1$$anonfun$1;
[error] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[error] at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[error] at com.android.dx.command.dexer.Main.processClass(Main.java:490)
[error] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
[error] at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[error] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
[error] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[error] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[error] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[error] at com.android.dx.command.dexer.Main.processOne(Main.java:422)
[error] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
[error] at com.android.dx.command.dexer.Main.run(Main.java:209)
[error] at com.android.dx.command.dexer.Main.main(Main.java:174)
[error] at com.android.dx.command.Main.main(Main.java:91)
[error] 1 error; aborting
[error] Total time: 17 s, completed 29.09.2013 4:14:12
Could you take a look?
Everytime when I tryed to 'install' the apk, this problem came out. I have two library projects. The sources file are here https://github.com/jinntrance/douban-android/
(douban-book/android:proguard) java.io.IOException: Can't write [/home/joseph/workspaces/douban-android/bin/classes.proguard.jar](Can't read [/home/joseph/workspaces/douban-android/bin/classes.jar%28;;;;!META-INF/**,!rootdoc.txt%29] %28Duplicate zip entry [classes.jar:com/google/zxing/client/android/HttpHelper$ContentType.class]%29)
I am working on a project which is getting larger and larger both in source code and in libraries I am using and it seems I have hit an upper limit.
I am getting this message:
warning: Ignoring InnerClasses attribute for an anonymous inner class
[warn] (org.apache.commons.logging.LogFactory$3) that doesn't come with an
[warn] associated EnclosingMethod attribute. This class was probably produced by a
[warn] compiler that did not target the modern .class file format. The recommended
[warn] solution is to recompile the class from source, using an up-to-date compiler
[warn] and without specifying any "-target" type options. The consequence of ignoring
[warn] this warning is that reflective operations on this class will incorrectly
[warn] indicate that it is *not* an inner class.
Whenever I see that I always end up with this: java.lang.OutOfMemoryError: GC overhead limit exceeded
Your plugin works better than jberkel plugin because after I do a clean
and an android:run
again it works (for now), despite being a slow process (more than 60 seconds on an i7 2.4GHz quad core laptop)
I have tried adding many proguard configurations with no luck.
I am using Scala 2.9.2 and Java 1.6. Should I change them? What is the most stable combination?
Any ideas would be most appreciated! Thanks
It's entirely possible I'm doing something wrong, as I'm pretty new to Scala--and sbt doubly so--but it looks like the generated TR.scala may reference classes from other packages to which it does not have permission to reference.
For example, adding a library dependency on Mixpanel 4.0.0 like so:
libraryDependencies += "com.mixpanel.android" % "mixpanel-android" %
"4.0.0" artifacts(Artifact("mixpanel-android", "aar", "aar"))
Produces errors of the form:
[error] .../gen/.../TR.scala:26: class CardCarouselLayout in package surveys cannot be accessed in package com.mixpanel.android.surveys
[error] val com_mixpanel_android_question_card_holder = TypedResource[com.mixpanel.android.surveys.CardCarouselLayout](R.id.com_mixpanel_android_question_card_holder)
... and so on.
This looks like it's because the plugin sniffs layout resources and Mixpanel has some layouts (eg., https://github.com/mixpanel/mixpanel-android/blob/34dd7eb6b12a0c475908bef8f41c9df8ad08cec0/src/main/res/layout/com_mixpanel_android_activity_survey.xml) that reference classes (eg., com.mixpanel.android.surveys.CardCarouselLayout) that are non-public.
There're some features that must be compiled by javac 1.7. I added javacOptions ++= Seq("-source", "1.7", "-target", "1.7")
to build.sbt but it's not work.
Here's my error.
error: diamond operator is not supported in -source 1.5
[error] Map<String, String> m = new HashMap<>();
[error] ^
[error] (use -source 7 or higher to enable diamond operator)
I think what I did is wrong. Do I need to do something with the plugin?
I'm trying to run simple empty project, but SBT fails with:
java.util.NoSuchElementException: key not found: sdk.dir
at scala.collection.MapLike$class.default(MapLike.scala:224)
at scala.collection.JavaConversions$JPropertiesWrapper.default(JavaConversions.scala:903)
at scala.collection.MapLike$class.apply(MapLike.scala:135)
at scala.collection.JavaConversions$JPropertiesWrapper.apply(JavaConversions.scala:903)
at AndroidSdkPlugin$$anonfun$androidBuildSettings$40.apply(rules.scala:193)
at AndroidSdkPlugin$$anonfun$androidBuildSettings$40.apply(rules.scala:193)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:41)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:41)
at sbt.EvaluateSettings$$anonfun$sbt$EvaluateSettings$$single$1.apply(INode.scala:155)
at sbt.EvaluateSettings$$anonfun$sbt$EvaluateSettings$$single$1.apply(INode.scala:155)
at sbt.EvaluateSettings$MixedNode.evaluate0(INode.scala:173)
at sbt.EvaluateSettings$INode.evaluate(INode.scala:129)
at sbt.EvaluateSettings$$anonfun$sbt$EvaluateSettings$$submitEvaluate$1.apply$mcV$sp(INode.scala:64)
at sbt.EvaluateSettings.sbt$EvaluateSettings$$run0(INode.scala:73)
at sbt.EvaluateSettings$$anon$3.run(INode.scala:69)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
[error] java.util.NoSuchElementException: key not found: sdk.dir```
Hello,
It looks like there is a problem linking with scala-library.jar in this case.
adb logcat gives the following error:
I/dalvikvm(19663): Failed resolving Leu/pulsation/alarmsandbox/AlarmSandboxActivity; interface 74 'Lscala/ScalaObject;'
[...]
E/AndroidRuntime(19663): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{eu.pulsation.alarmsandbox/eu.pulsation.alarmsandbox.AlarmSandboxActivity}: java.lang.ClassNotFound
Exception: Didn't find class "eu.pulsation.alarmsandbox.AlarmSandboxActivity" on path: /data/app/eu.pulsation.alarmsandbox-1.apk
Trying to build a Android project with a Android library and a Android project. Both containing scala code.
I have followed this https://gist.github.com/pfn/5872770 and created this Build.scala
import sbt._
import sbt.Keys._
import android.Keys._
object MyProjectBuild extends Build {
// meta project
lazy val root = Project(id = "ABM", base = file(".")) settings(Seq(
packageT in Compile <<= packageT in Android in ABM,
packageRelease <<= packageRelease in Android in ABM,
packageDebug <<= packageDebug in Android in ABM,
run <<= run in Android in ABM
) ++ android.Plugin.androidCommands: _*
) aggregate(ABM, GR)
// android application project
lazy val ABM = Project(id = "Custom", base = file("ABM")) settings(
android.Plugin.androidBuild(GR) ++ Seq(
proguardScala in Android := true,
proguardOptions in Android ++= Seq(
"-dontobfuscate",
"-dontoptimize"
)
): _*) dependsOn GR
val GenericRace = Project(id = "GR", base = file("GR")) settings (
Seq(
scalacOptions in Compile += "-deprecation",
javacOptions in Compile += "-deprecation",
libraryDependencies ++= Seq(/*
"com.viewpagerindicator" % "library" % "2.4.1" % "provided",
"com.android.support" % "support-v4" % "18.0.0",
"com.android.support" % "appcompat-v7" % "18.0.0"_/)
) ++ android.Plugin.androidBuild: __)
}
But whenever i run the application on a device i get Class not found exception
Could not find class 'scala.Some' or java.lang.NoClassDefFoundError: scala.concurrent.ExecutionContext
These files are not in the classes.dex.
The sbt-pgp plugin ("com.typesafe.sbt" % "sbt-pgp" % "0.8") uses a different version of Bouncy Castle which results in a VerifyError while attempting the ProGuard step. It took some time to figure out but the only conclusion I could make is that the above is the cause. I see that you are using minor version .48 while the pgp plugin is using .43 or something like that. In any case, I hope this can be fixed without having to manually disable the pgp plugin whenever I want to use your plugin. :)
Also (unrelated) you should update ProGuard version if possible to 4.9.
Great job on the plugin btw! :) I was considering switching to jberkel's but I see you are still updating this one so I'm staying, at least for some time. :)
The latest version available for net.sf.proguard is 4.11.
Does it make any difference changing it in the build.sbt? I've tried that and I still get "ProGuard, version 4.10" when it runs.
Being a newbie on sbt, I could not build a new project with your plugin.
Is there any template project that works out-of-the-box?
I set up a simple android project with android-sdk-plugin.
https://github.com/pocorall/hello-scaloid-sbt
This project runs well. However, I generated an IntelliJ project with sbt gen-idea
, the generated project does not have android library as a dependency.
So, I added the dependency in build.sbt
as:
libraryDependencies += "com.google.android" % "android" % "2.2.1" % "provided"
After re-run sbt gen-idea
, then I can see android library classes within IntelliJ.
But the problem comes from sbt side in this time. when I issued sbt android:package
, I got tons of errors something like:
Note: duplicate definition of library class [javax.xml.parsers.FactoryConfigurationError]
Note: duplicate definition of library class [javax.xml.parsers.DocumentBuilderFactory]
Note: duplicate definition of library class [javax.xml.transform.TransformerFactory]
Note: duplicate definition of library class [javax.xml.transform.stream.StreamResult]
Note: duplicate definition of library class [javax.xml.transform.stream.StreamSource]
Note: duplicate definition of library class [javax.xml.transform.TransformerException]
Note: duplicate definition of library class [javax.xml.transform.Result]
Note: duplicate definition of library class [javax.xml.transform.sax.SAXTransformerFactory
]
I guess android-sdk-plugin tries to do something with the newly added android dependency, and it is conflicted with something.
If I have a simple Activity that uses anonymous functions:
class MyActivity extends Activity with ViewFinder {
override def onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main)
val y = { (x: Int) => x + 1 }
Log.i("foo", y(4).toString)
}
}
my app crashes with :
01-04 23:47:52.853 1942-1942/com.example.Test D/AndroidRuntime﹕ Shutting down VM
01-04 23:47:52.853 1942-1942/com.example.Test W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb2cfdb08)
01-04 23:47:52.933 1942-1942/com.example.Test E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.Test, PID: 1942
java.lang.NoClassDefFoundError: com.example.Test.MyActivity$$anonfun$1
at com.example.Test.MyActivity.onCreate(MyActivity.scala:38)
at android.app.Activity.performCreate(Activity.java:5243)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
at android.app.ActivityThread.access$700(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4998)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
at dalvik.system.NativeStart.main(Native Method)
Currently, this plugin is the easiest way to get started using sbt/scala for an Android project. Adding support for sbt-idea would be a welcome addition, enabling further productivity in development using IntelliJ IDEA.
(FWIW, mpeltenon recently added support for generating Android facets for IDEA. )
Workaround: type reload
I have a project that emits an aar (which is produced by the plugin as well), which is in turn consumed by another project using the aar() dependency functionality.
Everything compiles fine, but during the proguard phase, the build fails with Duplicate zip entry [cklasses.jar:<package>/R$string.class
. Additionally, during the proguard scanning phase, printouts are made to indicate that there are duplicate definitions of classes.
After chatting to @pfn on IRC, it might be that the aar build process is including these classes, when it perhaps should not. This issue is just a reminder to double check and hopefully correct the problem.
I wrote an Android project that uses android-sdk-plugin (https://github.com/pocorall/hello-scaloid-sbt), and I succeeded to build it in my home computer.
But in other machine I used, the build was failed with an error as follows:
[info] Loading global plugins from C:\Users\onsquare\.sbt\plugins
[info] Loading project definition from C:\java\workspace\hello-scaloid-sbt\project
[info] Set current project to hello-scaloid-sbt (in build file:/C:/java/workspace/hello-scaloid-sbt/)
> android:package
[trace] Stack trace suppressed: run last android:sdk-parser for the full output.
[error] (android:sdk-parser) java.lang.NullPointerException
[error] Total time: 0 s, completed 2013. 8. 26 오후 1:52:49
> last
[debug] Running task... Cancelable: false, check cycles: false
java.lang.NullPointerException
at android.Plugin$$anonfun$allPluginSettings$57.apply(rules.scala:340)
at android.Plugin$$anonfun$allPluginSettings$57.apply(rules.scala:337)
at sbt.Scoped$$anonfun$hf4$1.apply(Structure.scala:580)
at sbt.Scoped$$anonfun$hf4$1.apply(Structure.scala:580)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
at sbt.std.Transform$$anon$5.work(System.scala:71)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:238)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
[error] (android:sdk-parser) java.lang.NullPointerException
[error] Total time: 0 s, completed 2013. 8. 26 오후 1:52:49
>
I can't figure out what is the problem. Please help me.
Hi,
First I hope you have good holidays :-)
I have another issue with your plugin. This time it's about the proguard cache.
I have added play-json to replace GSon which doesn't work well with Scala case class.
For that purpose, I added official typesafe rep, the dependency in the sbt file, and of course an entry in the proguardCache.
The first compilation is good, and works well.
The second compilation I always crash with that error message:
[error] Error Code:
[error] 1
[error] Output:
[error]
[error] UNEXPECTED TOP-LEVEL EXCEPTION:
[error] java.lang.IllegalArgumentException: already added: Lplay/api/libs/json/JsSuccess$;
[error] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
[error] at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
[error] at com.android.dx.command.dexer.Main.processClass(Main.java:685)
[error] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
[error] at com.android.dx.command.dexer.Main.access$600(Main.java:78)
[error] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
[error] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
[error] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
[error] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
[error] at com.android.dx.command.dexer.Main.processOne(Main.java:596)
[error] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
[error] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
[error] at com.android.dx.command.dexer.Main.run(Main.java:230)
[error] at com.android.dx.command.dexer.Main.main(Main.java:199)
[error] at com.android.dx.command.Main.main(Main.java:103)
[error] 1 error; aborting
[error] Total time: 16 s, completed 27 nov. 2013 13:37:37
[info] Set current project to OBackup (in build file:/home/geantvert/workspace/obackup_scala/)
I need to clean to make it work, any idea?
Regards
My SBT file:
...
libraryDependencies ++= Seq (
"org.scaloid" %% "scaloid" % "latest.integration",
"com.netflix.rxjava" % "rxjava-core" % "latest.integration",
"com.netflix.rxjava" % "rxjava-scala" % "latest.integration" intransitive(),
"com.netflix.rxjava" % "rxjava-android" % "latest.integration" intransitive(),
"com.android.support" % "support-v4" % "19.0.0",
"com.google.code.gson" % "gson" % "latest.integration",
"org.joda" % "joda-convert" % "1.5" intransitive(),
"joda-time" % "joda-time" % "2.3",
"com.googlecode.json-simple" % "json-simple" % "1.1" intransitive(),
"de.keyboardsurfer.android.widget" % "crouton" % "latest.integration" intransitive(),
"com.bugsense.trace" % "bugsense" % "3.5",
"com.google.android.gms" % "play-services" % "latest.integration" intransitive(),
"com.google.apis" % "google-api-services-drive" % "latest.integration" intransitive(),
"com.google.api-client" % "google-api-client" % "latest.integration" intransitive(),
"com.google.api-client" % "google-api-client-android" % "latest.integration" intransitive(),
"com.google.http-client" % "google-http-client-jackson" % "latest.integration" intransitive(),
"com.google.http-client" % "google-http-client-gson" % "latest.integration" intransitive(),
"com.typesafe.play" %% "play-json" % "2.2.0"
)
...
proguardCache in Android ++= Seq (
ProguardCache("org.scaloid") % "org.scaloid" %% "scaloid",
ProguardCache("rx") % "com.netflix.rxjava" %% "rxjava-core",
ProguardCache("rx") % "com.netflix.rxjava" %% "rxjava-scala",
ProguardCache("rx") % "com.netflix.rxjava" %% "rxjava-android",
ProguardCache("org.joda.time") % "joda-time" %% "joda-time",
ProguardCache("play") % "play" %% "play-json"
)
...
Is there a way to use sbt's ProjectRef to declare dependencies? I have my codebase split in 3 packages 2 of which are two generic "libraries" my other implementations depend on and one being the Android project. It would be the most convinient to be able to declare my own dependencies as ProjectRefs like I do from my other non Android sbt projects. Is there a way to do this with the plugin?
The relevant part of my build.scala looks something like this:
val lib1 = ProjectRef(uri(lib1path), "lib1")
val lib2 = ProjectRef(uri(lib2path), "lib2")
lazy val androidScala = Project(
id = "android-project",
base = file("."),
settings = projectSettings ++ Seq(
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/",
libraryDependencies ++= Seq(
"com.android.support" % "support-v4" % "19.1.0"
)
)
) dependsOn (lib1, lib2)
And the proguard error I am getting:
[info] Finding dependency references for: packagename:lib1:0.0
java.io.FileNotFoundException: /path/to/project/lib1/target/scala-2.10/classes (Is a directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at android.ReferenceFinder$.references(ReferenceFinder.scala:55)
at android.Tasks$$anonfun$62$$anonfun$apply$90.apply(tasks.scala:1062)
at android.Tasks$$anonfun$62$$anonfun$apply$90.apply(tasks.scala:1059)
at scala.collection.immutable.List.foreach(List.scala:318)
at android.Tasks$$anonfun$62.apply(tasks.scala:1059)
at android.Tasks$$anonfun$62.apply(tasks.scala:1031)
at scala.Function11$$anonfun$tupled$1.apply(Function11.scala:35)
at scala.Function11$$anonfun$tupled$1.apply(Function11.scala:34)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
[error] (android-project/android:proguardInputs) java.io.FileNotFoundException: /path/to/project/lib1/target/scala-2.10/classes (Is a directory)
I use https://github.com/scala/async (in an unmanaged jar). When hitting Proguard cache, I get this error:
[error] UNEXPECTED TOP-LEVEL EXCEPTION:
[error] java.lang.IllegalArgumentException: already added: Lscala/async/StateMachine;
[error] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[error] at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[error] at com.android.dx.command.dexer.Main.processClass(Main.java:490)
[error] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
[error] at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[error] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
[error] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[error] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[error] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[error] at com.android.dx.command.dexer.Main.processOne(Main.java:422)
[error] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
[error] at com.android.dx.command.dexer.Main.run(Main.java:209)
[error] at com.android.dx.command.dexer.Main.main(Main.java:174)
[error] at com.android.dx.command.Main.main(Main.java:91)
What and where should I add to circumvent this?
Android is moving to a new build system based on Gradle. This plugin should add support for the new build system.
This is connected to my previous problem. Earlier I was pulling my own dependencies from local repository with sbt's publish-local
and defining them as libraryDependencies
and it did work fine. For convenience I wanted to define my own project as ProjectRef in my android build and the exportJars
setting did indeed fix the problem but now the resources from the root of the dependency jar files won't get copied into the built apk file while they were working fine when I was using local repository. They are there in the classes.proguard.jar but they obviously don't get dexed but won't be put into the apk either causing runtime error when I try to load them.
I’m porting my project to your plugin and there’s an issue in how multiple support libraries are treated (that is, I didn’t have problems and now I do).
The library that causes the problems is this one: http://mvnrepository.com/artifact/com.viewpagerindicator/library/2.4.1:
exclude ("com.google.android", "support-v4")
Of course I have a dependency on support-v4 myself (the one from local Google repo).
So the proguard
task fails with this:
[error] (android:proguard) java.io.IOException: Can't write [...\target\android-bin\classes.proguard.jar] (Can't read [C:\Users\stanch\.ivy2\cache\com.android.support\support-v4\jars\support-v4-18.0.0.jar(;;;;!META-INF/**,!rootdoc.txt)] (Duplicate zip entry [support-v4-18.0.0.jar:android/support/v4/app/BackStackRecord$Op.class]))
If I delete the android-support-v4.jar
from ...\target\apklibs\com.viewpagerindicator-library-2.4.1\libs
, everything is ok.
Is there something you could do about this?
Hey,
great plugin :)
Could it be that native libraries are not included in the apk? They are not mentioned in the code and for my app they are missing in the apk: https://github.com/Marvin182/TicketChecker/tree/master/clients/android-sbt
I'm using android-sdk-plugin for the first time, but I get a NoClassDefFoundError when starting my application, which crashes my app.
Here are the logs:
01-04 12:09:50.128 1266-1351/system_process I/ActivityManager﹕ Start proc com.example.Test for activity com.example.Test/.MyActivity: pid=2176 uid=10051 gids={50051}
01-04 12:09:50.968 2176-2176/com.example.Test W/dalvikvm﹕ Unable to resolve superclass of Lcom/example/Test/MyActivity$$anonfun$onCreate$1; (63)
01-04 12:09:50.978 2176-2176/com.example.Test W/dalvikvm﹕ Link of class 'Lcom/example/Test/MyActivity$$anonfun$onCreate$1;' failed
01-04 12:09:50.988 2176-2176/com.example.Test E/dalvikvm﹕ Could not find class 'com.example.Test.MyActivity$$anonfun$onCreate$1', referenced from method com.example.Test.MyActivity.onCreate
01-04 12:09:50.998 2176-2176/com.example.Test W/dalvikvm﹕ VFY: unable to resolve new-instance 14 (Lcom/example/Test/MyActivity$$anonfun$onCreate$1;) in Lcom/example/Test/MyActivity;
01-04 12:09:50.998 2176-2176/com.example.Test D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x001e
01-04 12:09:51.048 2176-2176/com.example.Test W/dalvikvm﹕ Unable to resolve superclass of Lcom/example/Test/MyActivity$$anonfun$onCreate$1; (63)
01-04 12:09:51.108 2176-2176/com.example.Test W/dalvikvm﹕ Link of class 'Lcom/example/Test/MyActivity$$anonfun$onCreate$1;' failed
01-04 12:09:51.108 2176-2176/com.example.Test D/dalvikvm﹕ DexOpt: unable to opt direct call 0x000b at 0x20 in Lcom/example/Test/MyActivity;.onCreate
01-04 12:09:51.528 2176-2176/com.example.Test D/dalvikvm﹕ GC_FOR_ALLOC freed 86K, 5% free 2939K/3092K, paused 31ms, total 35ms
01-04 12:09:51.538 2176-2176/com.example.Test I/dalvikvm-heap﹕ Grow heap (frag case) to 3.538MB for 635808-byte allocation
01-04 12:09:51.598 2176-2185/com.example.Test D/dalvikvm﹕ GC_FOR_ALLOC freed 3K, 5% free 3556K/3716K, paused 57ms, total 57ms
01-04 12:09:51.668 2176-2176/com.example.Test D/AndroidRuntime﹕ Shutting down VM
01-04 12:09:51.668 2176-2176/com.example.Test W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb2cffb08)
01-04 12:09:51.688 2176-2176/com.example.Test E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.Test, PID: 2176
java.lang.NoClassDefFoundError: com.example.Test.MyActivity$$anonfun$onCreate$1
at com.example.Test.MyActivity.onCreate(MyActivity.scala:19)
at android.app.Activity.performCreate(Activity.java:5243)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
at android.app.ActivityThread.access$700(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4998)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
at dalvik.system.NativeStart.main(Native Method)
01-04 12:09:51.698 1266-1592/system_process W/ActivityManager﹕ Force finishing activity com.example.Test/.MyActivity
And here is the source of MyActivity:
object AndroidImplicits {
implicit class OnClickEnhancedView(v: View) {
def onClick(func: View => Any) {
v.setOnClickListener(new OnClickListener {
def onClick(v: View) = func(v)
})
}
def onClick(func: => Any) {
v.setOnClickListener(new OnClickListener {
def onClick(v: View) = func
})
}
}
}
trait ViewFinder extends Activity {
def findView[T](id: Int): T = this.findViewById(id).asInstanceOf[T]
}
import AndroidImplicits._
class MyActivity extends Activity with ViewFinder {
override def onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main)
val gridView = findView[GridView](R.id.gridView)
// println(gridView)
findView[Button](R.id.activate).onClick {
Toast.makeText(this, "Foo bar", Toast.LENGTH_LONG)
}
}
}
I thought maybe this was a Proguard issue, so I disabled Proguard (I think) by placing the following in my .sbt file (to no avail):
proguardScala in Android := false
useProguard in Android := false
Any idea what could be going on?
If I make a call to println before the offending line, I get a NoClassDefFoundError for Predef, so the problem seems to be finding any classes outside of the Android SDK and JDK.
Is this intentional? My workaround is to change something in the file and then run it again, but it's not very nice since sometimes I forget and then I might only realise after a while.
Sorry this is slightly IntelliJ-specific, but since it's the recommended IDE for this plugin: it seems IntelliJ puts a stub in gen/R.java
, which overwrites the R.java generated by sbt:
/* This stub is for using by IDE only. It is NOT the R class actually packed into APK */
public final class R {
}
People are complaining about this here http://youtrack.jetbrains.com/issue/IDEA-99045 but for now it's the by-design behaviour.
From what I can tell this seems to stop android-sdk-plugin from recognising that R.java
has changed, and so TR.scala
doesn't get rebuilt. Or sometimes I get other confusing resource-related problems with certain resources or resource IDs not showing up. I'm on the latest release (1.0.2). Sorry this isn't very specific but I'm still trying to get used to the whole toolchain and finding this stuff a bit confusing...
I'm migrating an existing project from jberkel/android-plugin to pfn/android-sdk-plugin and here's the errors I found:
septerra:android wiradikusuma$ sbt
[info] Loading project definition from /Users/wiradikusuma/Documents/code/myapp/android/project
[info] Set current project to myapp (in build file:/Users/wiradikusuma/Documents/code/myapp/android/)
clean
[success] Total time: 0 s, completed Sep 1, 2013 11:21:49 PM
android:package-debug
[warn] Ignoring build-tool '.DS_Store', not a folder.
...
[error] javac: file not found: /Users/wiradikusuma/Documents/code/myapp/android/target/android-gen/android/support/v7/appcompat/R.java
...
clean
[success] Total time: 0 s, completed Sep 1, 2013 11:24:39 PM
android:package-debug
[warn] Ignoring build-tool '.DS_Store', not a folder.
...
[success] Total time: 81 s, completed Sep 1, 2013 11:26:02 PM
android:run
[warn] Ignoring build-tool '.DS_Store', not a folder.
...
[error] trouble writing output: Too many methods: 76439; max is 65536. By package:
...
[error] 49615 org.scaloid.common
...
clean
[success] Total time: 0 s, completed Sep 1, 2013 11:32:04 PM
android:run
[warn] Ignoring build-tool '.DS_Store', not a folder.
...
[info] Creating proguard cache: proguard-cache-fa921084527f799d0bce8809094ff6edf2c47be7.jar
[info] Generating classes.dex
[info] Packaged: myapp-debug-unaligned.apk (1.23MB)
[info] Debug package does not need signing: myapp-debug-unaligned.apk
[info] zipaligned: myapp-debug.apk
[info] Installing...
[info] [myapp-debug.apk] Install finished: 1.23MB in 6.32s. 199.44KB/s
[info] Starting: Intent { cmp=com.myapp/.SearchActivity }
[success] Total time: 74 s, completed Sep 1, 2013 11:33:22 PM
import android.Keys._
import android.Dependencies.{apklib,aar}
android.Plugin.androidBuild
name := "myapp"
scalaVersion := "2.10.2"
scalacOptions in Compile += "-feature"
javacOptions in Compile += "-Xlint:deprecation"
libraryDependencies ++= Seq(
"org.apache.commons" % "commons-lang3" % "3.1",
"com.android.support" % "support-v4" % "18.0.0",
aar("com.android.support" % "appcompat-v7" % "18.0.0"),
"com.j256.ormlite" % "ormlite-android" % "4.46",
"com.github.chrisbanes.bitmapcache" % "library" % "2.3" exclude("com.google.android", "support-v4"),
apklib("com.viewpagerindicator" % "library" % "2.4.1" exclude("com.google.android", "support-v4")),
"org.scaloid" %% "scaloid" % "2.4-8"
)
platformTarget in Android := "android-16"
useProguard in Android := true
run <<= run in Android
install <<= install in Android
-keepattributes Signature
-keep @com.j256.ormlite.table.DatabaseTable public class * {
*;
}
-keepclassmembernames class scala.collection.* {
** next;
** head;
** tail;
}
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes Annotation
-keep public class * extends android.view.View {
public (android.content.Context);
public (android.content.Context, android.util.AttributeSet);
public (android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-keepclassmembers class * extends android.content.Context {
public void *(android.view.View);
public void *(android.view.MenuItem);
}
-keepclassmembers class *.R$ {
public static ;
}
-keep public class * extends android.widget.*
-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault
-keepclassmembers class * {
@com.google.api.client.util.Key ;
}
-dontwarn com.google.api.client.extensions.android.**
-dontwarn com.google.api.client.googleapis.extensions.android.**
-keepclassmembers class * {
public (android.content.Context);
}
-dontpreverify
-dontnote javax.xml.**
-dontnote org.w3c.dom.**
-dontnote org.xml.sax.**
-dontnote scala.Enumeration
-keep public class scala.Option
-keep public class scala.Function0
-keep public class scala.Function1
-keep public class scala.Function2
-keep public class scala.Product
-keep public class scala.Tuple2
-keep public class scala.collection.Seq
-keep public class scala.collection.immutable.List
-keep public class scala.collection.immutable.Map
-keep public class scala.collection.immutable.Seq
-keep public class scala.collection.immutable.Set
-keep public class scala.collection.immutable.Vector
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.appwidget.AppWidgetProvider
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.preference.Preference
-keepclasseswithmembernames class * {
native ;
}
-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static *[] values();
public static * valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keep class com.j256.**
-keepclassmembers class com.j256.* { ; }
-keep enum com.j256.
-keepclassmembers enum com.j256.* { ; }
-keep interface com.j256.
-keepclassmembers interface com.j256.** { *; }
-dontwarn scala.**
-keep class * implements org.xml.sax.EntityResolver
-keepclassmembers class * {
** MODULE$;
}
-keepclassmembernames class scala.concurrent.forkjoin.ForkJoinPool {
long eventCount;
int workerCounts;
int runControl;
long ctl;
** parkBlocker;
}
-keepclassmembernames class scala.concurrent.forkjoin.ForkJoinWorkerThread {
int base;
int sp;
int runState;
}
-keepclassmembernames class scala.concurrent.forkjoin.ForkJoinTask {
int status;
}
-keepclassmembernames class scala.concurrent.forkjoin.LinkedTransferQueue {
int sweepVotes;
scala.concurrent.forkjoin.LinkedTransferQueue$Node head;
scala.concurrent.forkjoin.LinkedTransferQueue$Node tail;
java.lang.Object item;
java.lang.Thread waiter;
}
I have an Android project which depends on the appcompact-v7
. I learned that the plugin currently cannot handle the res in the aar packages correctly. But I cannot figure out what should I to do include those resource files.
Currently I am see below errors:
t\app\target\android-bin\resources\res\values\values.xml:70: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
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.