我最近下载了最新的Android Studio 1.0版本,并立即开始试图让新项目启动并运行。我创建了一个新的地图项目,一旦我去运行它,它给了我以下内容:
Waiting for device.
Target device: motorola-xt1063-ZX1D3226RL
Uploading file
local path: C:\Users\Rich\Desktop\WebProjects\AndroidStudioProjects\BlocWork\BlocSpot\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.richluick.blocspot
Local path doesn't exist.
现在,我意识到存在类似的问题,但我尝试的任何工作都没有。我像大多数人建议的那样更新了.iml文件:
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="APK_PATH" value="/build/apk/blocspot-debug-unaligned.apk" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
这对我不起作用。由于其他人也在消化,我尝试了gradlew clean packagedebug --debug
命令并得到以下内容:
14:34:14.187 [ERROR] [org.gradle.BuildExceptionReporter]
14:34:14.190 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
14:34:14.198 [ERROR] [org.gradle.BuildExceptionReporter]
14:34:14.200 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
14:34:14.202 [ERROR] [org.gradle.BuildExceptionReporter] java.lang.NullPointerException (no error message)
14:34:14.204 [ERROR] [org.gradle.BuildExceptionReporter]
14:34:14.207 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
14:34:14.210 [ERROR] [org.gradle.BuildExceptionReporter] java.lang.NullPointerException
在编译gradle时,我不知道为什么或如何抛出Null Pointer Exception。我已经工作了好几个小时了,我无法让它工作。我希望有人可以帮助我。错误的堆栈跟踪如下。
14:34:14.212 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.builder.internal.compiler.PreDexCache.createItemNode(PreDexCache.java:189)
14:34:14.214 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.builder.internal.compiler.PreDexCache.createItemNode(PreDexCache.java:60)
14:34:14.216 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.builder.internal.compiler.PreProcessCache.saveItems(PreProcessCache.java:486)
14:34:14.218 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.builder.internal.compiler.PreProcessCache.clear(PreProcessCache.java:375)
14:34:14.220 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.builder.internal.compiler.PreProcessCache$clear$0.call(Unknown Source)
14:34:14.222 [ERROR] [org.gradle.BuildExceptionReporter] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
14:34:14.224 [ERROR] [org.gradle.BuildExceptionReporter] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
14:34:14.226 [ERROR] [org.gradle.BuildExceptionReporter] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
14:34:14.229 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.BasePlugin$_configureProject_closure1.doCall(BasePlugin.groovy:318)
14:34:14.231 [ERROR] [org.gradle.BuildExceptionReporter] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:34:14.232 [ERROR] [org.gradle.BuildExceptionReporter] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
14:34:14.234 [ERROR] [org.gradle.BuildExceptionReporter] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
14:34:14.236 [ERROR] [org.gradle.BuildExceptionReporter] at java.lang.reflect.Method.invoke(Method.java:483)
14:34:14.237 [ERROR] [org.gradle.BuildExceptionReporter] at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
14:34:14.239 [ERROR] [org.gradle.BuildExceptionReporter] at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
14:34:14.241 [ERROR] [org.gradle.BuildExceptionReporter] at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:278)
14:34:14.243 [ERROR] [org.gradle.BuildExceptionReporter] at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
14:34:14.245 [ERROR] [org.gradle.BuildExceptionReporter] at groovy.lang.Closure.call(Closure.java:423)
14:34:14.246 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
14:34:14.248 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
14:34:14.250 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:83)
14:34:14.251 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)
14:34:14.254 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
14:34:14.257 [ERROR] [org.gradle.BuildExceptionReporter] at com.sun.proxy.$Proxy12.buildFinished(Unknown Source)
14:34:14.259 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:111)
14:34:14.262 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
14:34:14.264 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
14:34:14.268 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
14:34:14.270 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
14:34:14.272 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
14:34:14.276 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
14:34:14.281 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
14:34:14.284 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
14:34:14.287 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
14:34:14.289 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
14:34:14.291 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
14:34:14.293 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
14:34:14.346 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
14:34:14.348 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
14:34:14.351 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
14:34:14.353 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
14:34:14.356 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:33)
14:34:14.576 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
14:34:14.578 [ERROR] [org.gradle.BuildExceptionReporter] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:34:14.581 [ERROR] [org.gradle.BuildExceptionReporter] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
14:34:14.583 [ERROR] [org.gradle.BuildExceptionReporter] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
14:34:14.631 [ERROR] [org.gradle.BuildExceptionReporter] at java.lang.reflect.Method.invoke(Method.java:483)
14:34:14.633 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
14:34:14.636 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
14:34:14.649 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
14:34:14.651 [ERROR] [org.gradle.BuildExceptionReporter] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:34:14.653 [ERROR] [org.gradle.BuildExceptionReporter] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
14:34:14.655 [ERROR] [org.gradle.BuildExceptionReporter] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
14:34:14.657 [ERROR] [org.gradle.BuildExceptionReporter] at java.lang.reflect.Method.invoke(Method.java:483)
14:34:14.659 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
14:34:14.661 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
14:34:14.664 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
14:34:14.669 [ERROR] [org.gradle.BuildExceptionReporter]
答案 0 :(得分:7)
试试这个。这帮助我,最终!!!
来源:Google Plus
PD:谢谢,Aman;)PD2:Android SDK Tools 24.0.1即将推出!!!答案 1 :(得分:4)
这就是我解决它的方法:
在应用程序的package main
import (
"fmt"
"reflect"
"net/http"
)
type Response struct {
http.ResponseWriter
Status int
}
func (r Response) WriteHeader(n int) {
r.Status = n
r.ResponseWriter.WriteHeader(n)
}
func middleware(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
resp := Response{ResponseWriter: w}
h.ServeHTTP(resp, r)
})
}
func root(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("root"))
fmt.Println(reflect.TypeOf(w))
fmt.Printf("%+v\n", w)
fmt.Println(w.Status) // <--- This causes an error.
}
func main() {
http.Handle("/", middleware(http.HandlerFunc(root)))
http.ListenAndServe(":8000", nil)
}
文件中,确保gradle版本至少为build.gradle
,如下所示:
1.1.0
且classpath 'com.android.tools.build:gradle:1.1.0'
部分包含repositories
而不是mavenCentral()
答案 2 :(得分:2)
尝试以下方法:
如果其他所有方法都失败,请恢复为v.0.9.3 found on the Canary频道。希望Google尽早解决问题。