无法使用SBT + SBT-Android插件构建Android +斯卡拉项目(Unable to

2019-10-18 04:29发布

使用SBT我不能构建Android +斯卡拉(和IntelliJ IDEA的12)项目SBT-Android插件 。 我安装了所需要的一切,并添加ANDROID_SDK_HOME双方.bashrc/etc/profile ,但是:

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

更新

    > 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

Answer 1:

首先,做sudo echo $ANDROID_HOME将是完全一样的echo $ANDROID_HOME ,因为变量将你的shell执行命令之前进行更换。

然后,你最有可能有权限问题。 尝试运行是为了确保你有合适的:

$ chmod -Rv 700 /home/me123/Documents/android_projects/my-android-project/


文章来源: Unable to build Android+Scala project using sbt+sbt-android plugin