fxthomas / android-scratch

Simple demo app for SBT-Android
6 stars 3 forks source link

error in Androidstudio #2

Closed shellyan closed 11 years ago

shellyan commented 11 years ago

Compile issue. Thats a long talk which I dont quite understand. :8ball:

error

BTW, could you tell me is there a smart way to set up structure automatically? Is it something in sbt-idea" % "1.5.0-SNAPSHOT or sbt-android?

error

fxthomas commented 11 years ago

I encourage you to look at the upcoming tutorial. It's not complete yet, but it should explain IntelliJ integration well enough.

(Also, no need to message me on multiple social networks, I do get mails from issues on GitHub ;) )

shellyan commented 11 years ago

thx. I'll wait for the upcoming tutorial. Is it gonna fix the ERROR: ANDROID PRE DEX?

fxthomas commented 11 years ago

Yes. Long story short, there's a working sbt-idea branch waiting for my SBT-Android commits to land on the master at jberkel/android-plugin. If you feel adventurous you could try it out ;)

(Well, actually, the current snapshot of sbt-idea should already work with the latest SBT-Android (0.6.4). But I made a few improvements on my branch!)

shellyan commented 11 years ago

thank you. I have been stuck on this for a while, I used to use your eclipse plugin for android development. Ill try it and report any issue.

My guess to use your branch is git checkout your branch, and publish locally. But I dont know is the right plugin name I should use in build.scala BTW, you hava a typo with your link: https://github.com/fxthomas/sbt-idea/tree/android-support

fxthomas commented 11 years ago

I encourage you not to use build.scala at first -- it's meant for more complex projects, and you may not even need it.

Try using a simple build.sbt like the one in this repository.

shellyan commented 11 years ago

yeah , I typed it wrong. it should be build.sbt. Could you give me a short instruction to use your sbt-idea branch?

fxthomas commented 11 years ago

Hm, hopefully, pull from GitHub, checkout, publish-local both my sbt-idea and sbt-android branches, then finally run sbt gen-idea from your project root. That should do it.

shellyan commented 11 years ago

what template should i use? I deleted global plugins and use your android-scratch. I got this error:

inbuild.sbt should I specify sbt-idea(your branch) like you did with sbt-android?

addSbtPlugin("org.scala-sbt" % "sbt-android" % "0.7-SNAPSHOT")

error

fxthomas commented 11 years ago

For the error, SBT-Android autodetects the version of the build-tools you installed with the Android SDK Manager. It may work better with the commit I just pushed. If it does not, can you send a list of all (including hidden) files in your $ANDROID_HOME/build-tools directory, along with the version of the Android SDK?

Plugins are not specified in build.sbt but in project/plugins.sbt. And yes, they should work with my latest sbt-android and sbt-idea branches. No need to use global plugins unless you really know what you're doing.

shellyan commented 11 years ago

hi sorry, i was busy with my work. Okie, I dont know how does publish-local works, so I must to have sbt-idea added in plugins.sbt in order to use it. But how does sbt know which one it should use, that was my question from last post. I added this to it:

resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.0-SNAPSHOT")

well, it still didnt work. same error showed on #2 I tired :(:

####groupID % artifactID % revision % configuration
addSbtPlugin("com.github.fxthomas" % "sbt-idea" % "1.5.0-SNAPSHOT")

I remember there was an error sbt could not find aapt and dex in platform-tools, so I created symbolic links to them.

fxthomas commented 11 years ago

No problem. I was busy with work too ;)

publish-local publishes JARs to the local Ivy repository, on your computer. So :

SBT will then automatically pick up dependencies from the local repository -- no need for an additional resolver. This is the project/plugins.sbt file I generally use right now for my Android projects :

addSbtPlugin("org.scala-sbt" % "sbt-android" % "0.7-SNAPSHOT")

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.0-SNAPSHOT")
shellyan commented 11 years ago

YEAH, it woks. I got it working with progaurd opted out. Thank you.

Here is a little prize for you:

thx

If I turn on progaurd. These are the errors:

[Scratch] /usr/local/Cellar/android-sdk/r22.0.1/tools/proguard/bin/proguard.sh: line 10: dirname: command not found
[Scratch] /usr/local/Cellar/android-sdk/r22.0.1/tools/proguard/bin/proguard.sh: line 12: java: command not found

This is waht is proguard.sh:

#!/bin/sh
#
# Start-up script for ProGuard -- free class file shrinker, optimizer,
# obfuscator, and preverifier for Java bytecode.
#
# Note: when passing file names containing spaces to this script,
#       you'll have to add escaped quotes around them, e.g.
#       "\"/My Directory/My File.txt\""

PROGUARD_HOME=`dirname "$0"`/..

java -jar $PROGUARD_HOME/lib/proguard.jar "$@"
fxthomas commented 11 years ago

LOL, thanks!

Erm... w00t for dirname not found. How can it not find dirname? This is like one of the most standard Unix commands. Can you run the ProGuard script manually (i.e. executing the .sh file on the command-line)?

shellyan commented 11 years ago

I can run it in terminal

/usr/local/Cellar/android-sdk/r22.0.1/tools/proguard/bin/proguard.sh ProgGuard, version 4.7 Usage: java proguard.ProGuard [options ...]

I think it's some path issue with IDEA

After reboot, it is working now with proguard. Thank you again. You can close now.