如何将Android支持v7库加载到SBT Android项目?

我创build了一个SBT项目,并使用pfn / android-sdk-plugin添加了一个Android模板,我所要做的就是创build一个用于实现recyclerview的testing应用程序。 aar()技术没有find依赖关系。 我的build.sbt

import sbt.Keys._ import android.Keys._ android.Plugin.androidBuild name := "firstsbt" version := "1.0" scalaVersion := "2.10.4" javacOptions ++= Seq("-source", "1.7", "-target", "1.7") scalacOptions in Compile ++= Seq("-deprecation","-feature","-language:implicitConversions","-unchecked") unmanagedBase := baseDirectory.value / "libs" // proguard help proguardScala in Android := true useProguard in Android := true //set dependencies libraryDependencies ++= Seq( //aar("com.android.support" % "cardview-v7" % "21.0.3"), //aar("com.android.support" % "appcompat-v7" % "23.1.1") "com.android.support" % "appcompat-v7" % "23.1.1" //"com.android.support" % "recyclerview-v7" % "23.1.1" //"com.android.support" % "support-v4" % "r7" % "23.1.1" //aar("com.android.support" % "recyclerview-v7" % "23.1.1") //aar("com.github.chrisbanes.actionbarpulltorefresh" % "library" % "0.9.3") //aar("net.simonvt.menudrawer" % "menudrawer" % "3.0.4"), //"com.google.android" % "support-v4" % "r7", //"io.spray" % "spray-json_2.10" % "1.2.6", //"net.minidev" % "json-smart" % "1.2") ) resolvers := Seq() 

我已经尝试将jar放入非托pipe项目库中,它会编译并安装,但会崩溃。

 12-13 18:02:40.760 7217-7217/mobile.bt.app D/AndroidRuntime﹕ Shutting down VM 12-13 18:02:40.760 7217-7217/mobile.bt.app E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: mobile.bt.app, PID: 7217 java.lang.RuntimeException: Unable to start activity ComponentInfo{mobile.bt.app/mobile.bt.app.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2661) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.access$900(ActivityThread.java:172) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5835) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference at mobile.bt.app.MainActivity.onCreate(MainActivity.java:62) at android.app.Activity.performCreate(Activity.java:6221) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2614)            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)            at android.app.ActivityThread.access$900(ActivityThread.java:172)            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)            at android.os.Handler.dispatchMessage(Handler.java:102)            at android.os.Looper.loop(Looper.java:145)            at android.app.ActivityThread.main(ActivityThread.java:5835)            at java.lang.reflect.Method.invoke(Native Method)            at java.lang.reflect.Method.invoke(Method.java:372)            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) 

当我取消注释ARR的我得到“依赖不能find”请帮助。

当我添加

 libraryDependencies += "com.android.support" % "appcompat-v7" % "23.1.1" 

这是我刚刚加载build.sbt的最新日志

  [info] Loading global plugins from C:\Users\brandon\.sbt\0.13\plugins [info] Loading project definition from C:\Users\brandon\IdeaProjects\firstsbt\project [info] Set current project to firstsbt (in build file:/C:/Users/brandon/IdeaProjects/firstsbt/) > [info] Defining *:shellPrompt [info] The new value will be used by no settings or tasks. [info] Reapplying settings... [info] Set current project to firstsbt (in build file:/C:/Users/brandon/IdeaProjects/firstsbt/) [info] Defining *:artifactPath [info] The new value will be used by no settings or tasks. [info] Reapplying settings... [info] Set current project to firstsbt (in build file:/C:/Users/brandon/IdeaProjects/firstsbt/) [info] Defining *:artifactClassifier [info] The new value will be used by compile:packageBin::artifact, compile:packageDoc::artifact and 3 others. [info] Run `last` for details. [info] Reapplying settings... [info] Set current project to firstsbt (in build file:/C:/Users/brandon/IdeaProjects/firstsbt/) [info] Applying State transformations org.jetbrains.sbt.ReadProject from C:/Users/brandon/.IntelliJIdea15/config/plugins/Scala/launcher/sbt-structure-0.13.jar [info] Reading structure from C:\Users\brandon\IdeaProjects\firstsbt [info] Updating {file:/C:/Users/brandon/IdeaProjects/firstsbt/}mobile-bt-app... [info] Resolving com.android.support#appcompat-v7;23.1.1 ... [info] Resolving com.android.support#appcompat-v7;23.1.1 ... [warn] module not found: com.android.support#appcompat-v7;23.1.1 [warn] ==== local: tried [warn] C:\Users\brandon\.ivy2\local\com.android.support\appcompat-v7\23.1.1\ivys\ivy.xml [warn] ==== public: tried [warn] https://repo1.maven.org/maven2/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.pom [info] Resolving org.scala-lang#scala-compiler;2.10.4 ... [info] Resolving org.scala-lang#scala-library;2.10.4 ... [info] Resolving org.scala-lang#scala-reflect;2.10.4 ... [info] Resolving org.scala-lang#jline;2.10.4 ... [info] Resolving org.fusesource.jansi#jansi;1.4 ... [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: com.android.support#appcompat-v7;23.1.1: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] [warn] Note: Unresolved dependencies path: [warn] com.android.support:appcompat-v7:23.1.1 (C:\Users\brandon\IdeaProjects\firstsbt\build.sbt#L19-32) [warn] +- firstsbt:firstsbt:1.0 [trace] Stack trace suppressed: run 'last *:update' for the full output. [error] (*:update) sbt.ResolveException: unresolved dependency: com.android.support#appcompat-v7;23.1.1: not found sbt.ResolveException: unresolved dependency: com.android.support#appcompat-v7;23.1.1: not found at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:291) at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:188) at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:165) at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155) at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155) at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:132) at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57) at sbt.IvySbt$$anon$4.call(Ivy.scala:65) at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93) at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78) at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97) at xsbt.boot.Using$.withResource(Using.scala:10) at xsbt.boot.Using$.apply(Using.scala:9) at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58) at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48) at xsbt.boot.Locks$.apply0(Locks.scala:31) at xsbt.boot.Locks$.apply(Locks.scala:28) at sbt.IvySbt.withDefaultLogger(Ivy.scala:65) at sbt.IvySbt.withIvy(Ivy.scala:127) at sbt.IvySbt.withIvy(Ivy.scala:124) at sbt.IvySbt$Module.withModule(Ivy.scala:155) at sbt.IvyActions$.updateEither(IvyActions.scala:165) at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1369) at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1365) at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1399) at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1397) at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37) at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1402) at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1396) at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60) at sbt.Classpaths$.cachedUpdate(Defaults.scala:1419) at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1348) at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1310) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40) at sbt.std.Transform$$anon$4.work(System.scala:63) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17) at sbt.Execute.work(Execute.scala:235) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159) at sbt.CompletionService$$anon$2.call(CompletionService.scala:28) 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:745) [error] sbt.ResolveException: unresolved dependency: com.android.support#appcompat-v7;23.1.1: not found [error] Use 'last' for the full log. 

Solutions Collecting From Web of "如何将Android支持v7库加载到SBT Android项目?"

 libraryDependencies += "com.android.support" % "appcompat-v7" % "23.1.1" 

不要忘了在SDKpipe理器中安装android支持库

你也不能解决依赖关系,如果你设置resolvers := ()