我正在尝试从我的物理设备上的android工作室运行该应用程序。但每次我这样做,Gradle Build
都会显示此错误
Information:Gradle tasks [:app:assembleDebug]
Information:BUILD SUCCESSFUL in 10s
Error:Already finished
Information:BUILD FAILED in 10s
Information:1 error
Information:0 warnings
Information:See complete output in console
我经历了这个link并尝试了每个答案,但错误一直在显示。此外,我注意到该应用程序的文件夹包含.gradle
文件夹,我尝试删除它,但每次Rebuild Project/Clean Project
该文件夹都会自动显示。
此外,每次创建新项目时,我都会遇到此错误。
在终端中运行./gradlew assembleDebug --info
后,日志如下所示:
Initialized native services in: /home/shaloin/.gradle/native
Found daemon DaemonInfo{pid=17048, address=[fc6fb39e-af80-499f-a671-d7966fec4f29 port:33345, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1519376060898, context=DefaultDaemonContext[uid=b05f2429-3b72-4dbb-9b66-3861bb909eee,javaHome=/usr/local/android-studio/jre,daemonRegistryDir=/home/shaloin/.gradle/daemon,pid=17048,idleTimeout=10800000,daemonOpts=-Xmx1536m,-Dfile.encoding=UTF-8,-Duser.country=IN,-Duser.language=en,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/usr/lib/jvm/java-8-oracle,daemonRegistryDir=/home/shaloin/.gradle/daemon,pid=553,idleTimeout=null,daemonOpts=-Xmx1536m,-Dfile.encoding=UTF-8,-Duser.country=IN,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=b05f2429-3b72-4dbb-9b66-3861bb909eee,javaHome=/usr/local/android-studio/jre,daemonRegistryDir=/home/shaloin/.gradle/daemon,pid=17048,idleTimeout=10800000,daemonOpts=-Xmx1536m,-Dfile.encoding=UTF-8,-Duser.country=IN,-Duser.language=en,-Duser.variant]
Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 335). The daemon log file: /home/shaloin/.gradle/daemon/4.1/daemon-335.out.log
Starting 2nd build in daemon [uptime: 3 mins 8.377 secs, performance: 99%, no major garbage collections]
Using 4 worker leases.
Creating new cache for fileHashes, path /home/shaloin/AndroidStudioProjects/CodeSearch/.gradle/4.1/fileHashes/fileHashes.bin, access org.gradle.cache.internal.DefaultCacheAccess@70f708a8
Creating new cache for plugin-use-metadata, path /home/shaloin/.gradle/caches/4.1/plugin-resolution/plugin-use-metadata.bin, access org.gradle.cache.internal.DefaultCacheAccess@79864311
Creating new cache for client-status, path /home/shaloin/.gradle/caches/4.1/plugin-resolution/client-status.bin, access org.gradle.cache.internal.DefaultCacheAccess@79864311
Starting Build
Settings evaluated using settings file '/home/shaloin/AndroidStudioProjects/CodeSearch/settings.gradle'.
Projects loaded. Root project using build file '/home/shaloin/AndroidStudioProjects/CodeSearch/build.gradle'.
Included projects: [root project 'CodeSearch', project ':app']
> Configure project :
Evaluating root project 'CodeSearch' using build file '/home/shaloin/AndroidStudioProjects/CodeSearch/build.gradle'.
Creating new cache for metadata-1.1/results, path /home/shaloin/.gradle/caches/transforms-1/metadata-1.1/results.bin, access org.gradle.cache.internal.DefaultCacheAccess@740f0509
Creating new cache for metadata-2.23/module-metadata, path /home/shaloin/.gradle/caches/modules-2/metadata-2.23/module-metadata.bin, access org.gradle.cache.internal.DefaultCacheAccess@6663ad7c
Creating new cache for metadata-2.23/artifact-at-repository, path /home/shaloin/.gradle/caches/modules-2/metadata-2.23/artifact-at-repository.bin, access org.gradle.cache.internal.DefaultCacheAccess@6663ad7c
> Configure project :app
Evaluating project ':app' using build file '/home/shaloin/AndroidStudioProjects/CodeSearch/app/build.gradle'.
Creating configuration androidTestUtil
Creating configuration compile
Creating configuration apk
Creating configuration provided
Creating configuration api
Creating configuration implementation
Creating configuration runtimeOnly
Creating configuration compileOnly
Creating configuration wearApp
Creating configuration annotationProcessor
Creating configuration androidTestCompile
Creating configuration androidTestApk
Creating configuration androidTestProvided
Creating configuration androidTestApi
Creating configuration androidTestImplementation
Creating configuration androidTestRuntimeOnly
Creating configuration androidTestCompileOnly
Creating configuration androidTestWearApp
Creating configuration androidTestAnnotationProcessor
Creating configuration testCompile
Creating configuration testApk
Creating configuration testProvided
Creating configuration testApi
Creating configuration testImplementation
Creating configuration testRuntimeOnly
Creating configuration testCompileOnly
Creating configuration testWearApp
Creating configuration testAnnotationProcessor
Creating configuration debugCompile
Creating configuration debugApk
Creating configuration debugProvided
Creating configuration debugApi
Creating configuration debugImplementation
Creating configuration debugRuntimeOnly
Creating configuration debugCompileOnly
Creating configuration debugWearApp
Creating configuration debugAnnotationProcessor
Creating configuration androidTestDebugCompile
Creating configuration androidTestDebugApk
Creating configuration androidTestDebugProvided
Creating configuration androidTestDebugApi
Creating configuration androidTestDebugImplementation
Creating configuration androidTestDebugRuntimeOnly
Creating configuration androidTestDebugCompileOnly
Creating configuration androidTestDebugWearApp
Creating configuration androidTestDebugAnnotationProcessor
Creating configuration testDebugCompile
Creating configuration testDebugApk
Creating configuration testDebugProvided
Creating configuration testDebugApi
Creating configuration testDebugImplementation
Creating configuration testDebugRuntimeOnly
Creating configuration testDebugCompileOnly
Creating configuration testDebugWearApp
Creating configuration testDebugAnnotationProcessor
Creating configuration releaseCompile
Creating configuration releaseApk
Creating configuration releaseProvided
Creating configuration releaseApi
Creating configuration releaseImplementation
Creating configuration releaseRuntimeOnly
Creating configuration releaseCompileOnly
Creating configuration releaseWearApp
Creating configuration releaseAnnotationProcessor
Creating configuration testReleaseCompile
Creating configuration testReleaseApk
Creating configuration testReleaseProvided
Creating configuration testReleaseApi
Creating configuration testReleaseImplementation
Creating configuration testReleaseRuntimeOnly
Creating configuration testReleaseCompileOnly
Creating configuration testReleaseWearApp
Creating configuration testReleaseAnnotationProcessor
Parsing the SDK, no caching allowed
SDK initialized in 17 ms
Using incremental javac compilation for :app debug.
Using incremental javac compilation for :app debugUnitTest.
Using incremental javac compilation for :app release.
Using incremental javac compilation for :app releaseUnitTest.
Using incremental javac compilation for :app debugAndroidTest.
All projects evaluated.
Selected primary task 'assembleDebug' from project :
Creating new cache for annotation-processors, path /home/shaloin/AndroidStudioProjects/CodeSearch/.gradle/4.1/fileContent/annotation-processors.bin, access org.gradle.cache.internal.DefaultCacheAccess@72abf1bc
Tasks to be executed: [task ':app:preBuild', task ':app:preDebugBuild', task ':app:compileDebugAidl', task ':app:compileDebugRenderscript', task ':app:checkDebugManifest', task ':app:generateDebugBuildConfig', task ':app:prepareLintJar', task ':app:generateDebugResValues', task ':app:generateDebugResources', task ':app:mergeDebugResources', task ':app:createDebugCompatibleScreenManifests', task ':app:processDebugManifest', task ':app:splitsDiscoveryTaskDebug', task ':app:processDebugResources', task ':app:generateDebugSources', task ':app:javaPreCompileDebug', task ':app:compileDebugJavaWithJavac', task ':app:compileDebugNdk', task ':app:compileDebugSources', task ':app:mergeDebugShaders', task ':app:compileDebugShaders', task ':app:generateDebugAssets', task ':app:mergeDebugAssets', task ':app:transformClassesWithDexBuilderForDebug', task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug', task ':app:transformDexArchiveWithDexMergerForDebug', task ':app:mergeDebugJniLibFolders', task ':app:transformNativeLibsWithMergeJniLibsForDebug', task ':app:transformNativeLibsWithStripDebugSymbolForDebug', task ':app:processDebugJavaRes', task ':app:transformResourcesWithMergeJavaResForDebug', task ':app:validateSigningDebug', task ':app:packageDebug', task ':app:assembleDebug']
Creating new cache for resourceHashesCache, path /home/shaloin/AndroidStudioProjects/CodeSearch/.gradle/4.1/fileHashes/resourceHashesCache.bin, access org.gradle.cache.internal.DefaultCacheAccess@70f708a8
Creating new cache for fileSnapshots, path /home/shaloin/AndroidStudioProjects/CodeSearch/.gradle/4.1/taskHistory/fileSnapshots.bin, access org.gradle.cache.internal.DefaultCacheAccess@37a72cc7
Creating new cache for taskHistory, path /home/shaloin/AndroidStudioProjects/CodeSearch/.gradle/4.1/taskHistory/taskHistory.bin, access org.gradle.cache.internal.DefaultCacheAccess@37a72cc7
:app:preBuild (Thread[Task worker for ':',5,main]) started.
> Task :app:preBuild
Skipping task ':app:preBuild' as it has no actions.
:app:preBuild (Thread[Task worker for ':',5,main]) completed. Took 0.0 secs.
:app:preDebugBuild (Thread[Task worker for ':',5,main]) started.
> Task :app:preDebugBuild
Putting task artifact state for task ':app:preDebugBuild' into context took 0.0 secs.
Creating new cache for metadata-2.23/module-artifacts, path /home/shaloin/.gradle/caches/modules-2/metadata-2.23/module-artifacts.bin, access org.gradle.cache.internal.DefaultCacheAccess@6663ad7c
Skipping task ':app:preDebugBuild' as it is up-to-date (took 0.104 secs).
:app:preDebugBuild (Thread[Task worker for ':',5,main]) completed. Took 0.106 secs.
:app:compileDebugAidl (Thread[Task worker for ':' Thread 2,5,main]) started.
> Task :app:compileDebugAidl
Putting task artifact state for task ':app:compileDebugAidl' into context took 0.0 secs.
Skipping task ':app:compileDebugAidl' as it is up-to-date (took 0.012 secs).
:app:compileDebugAidl (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.013 secs.
:app:compileDebugRenderscript (Thread[Task worker for ':' Thread 2,5,main]) started.
> Task :app:compileDebugRenderscript
Putting task artifact state for task ':app:compileDebugRenderscript' into context took 0.0 secs.
Skipping task ':app:compileDebugRenderscript' as it is up-to-date (took 0.006 secs).
:app:compileDebugRenderscript (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.007 secs.
:app:checkDebugManifest (Thread[Task worker for ':' Thread 3,5,main]) started.
> Task :app:checkDebugManifest
Putting task artifact state for task ':app:checkDebugManifest' into context took 0.0 secs.
Skipping task ':app:checkDebugManifest' as it is up-to-date (took 0.001 secs).
:app:checkDebugManifest (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.001 secs.
:app:generateDebugBuildConfig (Thread[Task worker for ':' Thread 3,5,main]) started.
> Task :app:generateDebugBuildConfig
Putting task artifact state for task ':app:generateDebugBuildConfig' into context took 0.0 secs.
Skipping task ':app:generateDebugBuildConfig' as it is up-to-date (took 0.004 secs).
:app:generateDebugBuildConfig (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.004 secs.
:app:prepareLintJar (Thread[Daemon worker Thread 2,5,main]) started.
> Task :app:prepareLintJar
Putting task artifact state for task ':app:prepareLintJar' into context took 0.0 secs.
Skipping task ':app:prepareLintJar' as it is up-to-date (took 0.005 secs).
:app:prepareLintJar (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.005 secs.
:app:generateDebugResValues (Thread[Daemon worker Thread 2,5,main]) started.
> Task :app:generateDebugResValues
Putting task artifact state for task ':app:generateDebugResValues' into context took 0.0 secs.
Skipping task ':app:generateDebugResValues' as it is up-to-date (took 0.001 secs).
:app:generateDebugResValues (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.002 secs.
:app:generateDebugResources (Thread[Daemon worker Thread 2,5,main]) started.
> Task :app:generateDebugResources
Skipping task ':app:generateDebugResources' as it has no actions.
:app:generateDebugResources (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.001 secs.
:app:mergeDebugResources (Thread[Daemon worker Thread 2,5,main]) started.
> Task :app:mergeDebugResources
Putting task artifact state for task ':app:mergeDebugResources' into context took 0.0 secs.
Skipping task ':app:mergeDebugResources' as it is up-to-date (took 0.042 secs).
:app:mergeDebugResources (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.043 secs.
:app:createDebugCompatibleScreenManifests (Thread[Task worker for ':' Thread 2,5,main]) started.
> Task :app:createDebugCompatibleScreenManifests
Putting task artifact state for task ':app:createDebugCompatibleScreenManifests' into context took 0.0 secs.
Skipping task ':app:createDebugCompatibleScreenManifests' as it is up-to-date (took 0.001 secs).
:app:createDebugCompatibleScreenManifests (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.002 secs.
:app:processDebugManifest (Thread[Task worker for ':' Thread 2,5,main]) started.
> Task :app:processDebugManifest
Putting task artifact state for task ':app:processDebugManifest' into context took 0.0 secs.
Skipping task ':app:processDebugManifest' as it is up-to-date (took 0.005 secs).
:app:processDebugManifest (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.008 secs.
:app:splitsDiscoveryTaskDebug (Thread[Task worker for ':' Thread 2,5,main]) started.
> Task :app:splitsDiscoveryTaskDebug
Putting task artifact state for task ':app:splitsDiscoveryTaskDebug' into context took 0.0 secs.
Skipping task ':app:splitsDiscoveryTaskDebug' as it is up-to-date (took 0.001 secs).
:app:splitsDiscoveryTaskDebug (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.001 secs.
:app:processDebugResources (Thread[Task worker for ':' Thread 2,5,main]) started.
> Task :app:processDebugResources
Putting task artifact state for task ':app:processDebugResources' into context took 0.001 secs.
Skipping task ':app:processDebugResources' as it is up-to-date (took 0.028 secs).
:app:processDebugResources (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.029 secs.
:app:generateDebugSources (Thread[Daemon worker Thread 2,5,main]) started.
> Task :app:generateDebugSources
Skipping task ':app:generateDebugSources' as it has no actions.
:app:generateDebugSources (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.0 secs.
:app:javaPreCompileDebug (Thread[Daemon worker Thread 2,5,main]) started.
> Task :app:javaPreCompileDebug
Putting task artifact state for task ':app:javaPreCompileDebug' into context took 0.0 secs.
Skipping task ':app:javaPreCompileDebug' as it is up-to-date (took 0.008 secs).
:app:javaPreCompileDebug (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.009 secs.
:app:compileDebugJavaWithJavac (Thread[Task worker for ':' Thread 3,5,main]) started.
> Task :app:compileDebugJavaWithJavac
Putting task artifact state for task ':app:compileDebugJavaWithJavac' into context took 0.001 secs.
file or directory '/home/shaloin/AndroidStudioProjects/CodeSearch/app/src/debug/java', not found
Skipping task ':app:compileDebugJavaWithJavac' as it is up-to-date (took 0.009 secs).
:app:compileDebugJavaWithJavac (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.012 secs.
:app:compileDebugNdk (Thread[Task worker for ':',5,main]) started.
> Task :app:compileDebugNdk
Putting task artifact state for task ':app:compileDebugNdk' into context took 0.0 secs.
Skipping task ':app:compileDebugNdk' as it has no source files and no previous output files.
:app:compileDebugNdk (Thread[Task worker for ':',5,main]) completed. Took 0.001 secs.
:app:compileDebugSources (Thread[Task worker for ':',5,main]) started.
> Task :app:compileDebugSources
Skipping task ':app:compileDebugSources' as it has no actions.
:app:compileDebugSources (Thread[Task worker for ':',5,main]) completed. Took 0.0 secs.
:app:mergeDebugShaders (Thread[Task worker for ':',5,main]) started.
> Task :app:mergeDebugShaders
Putting task artifact state for task ':app:mergeDebugShaders' into context took 0.0 secs.
Skipping task ':app:mergeDebugShaders' as it is up-to-date (took 0.001 secs).
:app:mergeDebugShaders (Thread[Task worker for ':',5,main]) completed. Took 0.002 secs.
:app:compileDebugShaders (Thread[Task worker for ':',5,main]) started.
> Task :app:compileDebugShaders
Putting task artifact state for task ':app:compileDebugShaders' into context took 0.0 secs.
Skipping task ':app:compileDebugShaders' as it is up-to-date (took 0.001 secs).
:app:compileDebugShaders (Thread[Task worker for ':',5,main]) completed. Took 0.001 secs.
:app:generateDebugAssets (Thread[Task worker for ':',5,main]) started.
> Task :app:generateDebugAssets
Skipping task ':app:generateDebugAssets' as it has no actions.
:app:generateDebugAssets (Thread[Task worker for ':',5,main]) completed. Took 0.0 secs.
:app:mergeDebugAssets (Thread[Task worker for ':',5,main]) started.
> Task :app:mergeDebugAssets
Putting task artifact state for task ':app:mergeDebugAssets' into context took 0.0 secs.
Skipping task ':app:mergeDebugAssets' as it is up-to-date (took 0.006 secs).
:app:mergeDebugAssets (Thread[Task worker for ':',5,main]) completed. Took 0.006 secs.
:app:transformClassesWithDexBuilderForDebug (Thread[Task worker for ':',5,main]) started.
> Task :app:transformClassesWithDexBuilderForDebug
Putting task artifact state for task ':app:transformClassesWithDexBuilderForDebug' into context took 0.0 secs.
Skipping task ':app:transformClassesWithDexBuilderForDebug' as it is up-to-date (took 0.015 secs).
:app:transformClassesWithDexBuilderForDebug (Thread[Task worker for ':',5,main]) completed. Took 0.015 secs.
:app:transformDexArchiveWithExternalLibsDexMergerForDebug (Thread[Task worker for ':' Thread 3,5,main]) started.
> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug
Putting task artifact state for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' into context took 0.0 secs.
Skipping task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' as it is up-to-date (took 0.005 secs).
:app:transformDexArchiveWithExternalLibsDexMergerForDebug (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.006 secs.
:app:transformDexArchiveWithDexMergerForDebug (Thread[Task worker for ':' Thread 3,5,main]) started.
> Task :app:transformDexArchiveWithDexMergerForDebug
Putting task artifact state for task ':app:transformDexArchiveWithDexMergerForDebug' into context took 0.0 secs.
Skipping task ':app:transformDexArchiveWithDexMergerForDebug' as it is up-to-date (took 0.004 secs).
:app:transformDexArchiveWithDexMergerForDebug (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.005 secs.
:app:mergeDebugJniLibFolders (Thread[Task worker for ':' Thread 3,5,main]) started.
> Task :app:mergeDebugJniLibFolders
Putting task artifact state for task ':app:mergeDebugJniLibFolders' into context took 0.0 secs.
Skipping task ':app:mergeDebugJniLibFolders' as it is up-to-date (took 0.001 secs).
:app:mergeDebugJniLibFolders (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.003 secs.
:app:transformNativeLibsWithMergeJniLibsForDebug (Thread[Task worker for ':' Thread 3,5,main]) started.
> Task :app:transformNativeLibsWithMergeJniLibsForDebug
Putting task artifact state for task ':app:transformNativeLibsWithMergeJniLibsForDebug' into context took 0.0 secs.
Skipping task ':app:transformNativeLibsWithMergeJniLibsForDebug' as it is up-to-date (took 0.012 secs).
:app:transformNativeLibsWithMergeJniLibsForDebug (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.013 secs.
:app:transformNativeLibsWithStripDebugSymbolForDebug (Thread[Task worker for ':' Thread 3,5,main]) started.
> Task :app:transformNativeLibsWithStripDebugSymbolForDebug
Putting task artifact state for task ':app:transformNativeLibsWithStripDebugSymbolForDebug' into context took 0.0 secs.
Skipping task ':app:transformNativeLibsWithStripDebugSymbolForDebug' as it is up-to-date (took 0.011 secs).
:app:transformNativeLibsWithStripDebugSymbolForDebug (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.012 secs.
:app:processDebugJavaRes (Thread[Task worker for ':' Thread 3,5,main]) started.
> Task :app:processDebugJavaRes
Putting task artifact state for task ':app:processDebugJavaRes' into context took 0.0 secs.
Skipping task ':app:processDebugJavaRes' as it has no source files and no previous output files.
:app:processDebugJavaRes (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.002 secs.
:app:transformResourcesWithMergeJavaResForDebug (Thread[Task worker for ':' Thread 3,5,main]) started.
> Task :app:transformResourcesWithMergeJavaResForDebug
Putting task artifact state for task ':app:transformResourcesWithMergeJavaResForDebug' into context took 0.0 secs.
Skipping task ':app:transformResourcesWithMergeJavaResForDebug' as it is up-to-date (took 0.013 secs).
:app:transformResourcesWithMergeJavaResForDebug (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.015 secs.
:app:validateSigningDebug (Thread[Daemon worker Thread 2,5,main]) started.
> Task :app:validateSigningDebug
Putting task artifact state for task ':app:validateSigningDebug' into context took 0.0 secs.
Executing task ':app:validateSigningDebug' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
:app:validateSigningDebug (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.009 secs.
:app:packageDebug (Thread[Daemon worker Thread 2,5,main]) started.
> Task :app:packageDebug
Putting task artifact state for task ':app:packageDebug' into context took 0.0 secs.
Skipping task ':app:packageDebug' as it is up-to-date (took 0.023 secs).
:app:packageDebug (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.027 secs.
:app:assembleDebug (Thread[Daemon worker Thread 2,5,main]) started.
> Task :app:assembleDebug
Skipping task ':app:assembleDebug' as it has no actions.
:app:assembleDebug (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.001 secs.
BUILD SUCCESSFUL in 1s
26 actionable tasks: 1 executed, 25 up-to-date
有人可以帮助我吗?
答案 0 :(得分:0)
解决方案1 (这不是我的答案,归功于此user和此user)
原因是我在“运行/调试配置”对话框中定义了一个新配置,并将完整路径放在Gradle project:字段中的build.gradle文件中,如下所示。 (我通过单击字段右侧的省略号(...)按钮来完成此操作,但我也可以直接输入它。)
但是,我应该做的是遵循现有配置中的模式,其中Gradle项目:被指定为“已注册项目”,方法是单击该字段右侧的“文件夹”图标,以绿色突出显示以下图片在这种情况下,字段的内容只是项目名称,并以略微不同的背景/前景色显示。 (我意外地发现右键单击此名称会将其替换为包含build.gradle的文件夹的路径,但如果您取消并再次开始编辑配置,它仍将显示为项目名称。)
在您之后gradle.properties
插入以下行(所有信用都转到此user):
org.gradle.jvmargs=-Xmx1536m
org.gradle.java.home=${path to java sdk}
您可以使用以下内容获取java sdk
的路径
步骤(reference):
第1步
$ whereis java
java: /usr/bin/java /etc/java /usr/share/java
第2步
$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2009-01-15 18:34 /usr/bin/java ->
/etc/alternatives/java
第3步
$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 31 2009-01-15 18:34 /etc/alternatives/java ->
/usr/local/jre1.6.0_07/bin/java
java的实际位置:/ usr / local / jre .....
在我的情况下,sdk出现在/usr/lib/jvm/java-1.7.0-openjdk-amd64
中,我只是将${path to java sdk}
替换为/usr/lib/jvm/java-1.7.0-openjdk-amd64
,就是这样,我很高兴。
解决方案2
上述解决方案对我有用,但我也尝试卸载然后重新安装android studio。它也有效。