您的位置:首页 > 编程语言 > Java开发

从Eclipse ADT 切换到 Android Studio遇到的问题及解决办法汇总

2015-11-13 12:06 567 查看



前言

应公司项目开发要求,需从eclips切换到studio,花了两天时间才把原来的程序顺利转过来运行,效率确实有点低。只想说一句:切换过来真的觉得很不习惯。下面将遇到的问题及解决办法罗列如下(解决办法基本来源于网络),一方面加深记忆,另一方面希望能帮助遇到同样问题的同学快速解决问题,提高效率。

问题一

导入Eclipse的工程,Gradle编译错误

Error:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.


解决办法:

在操作系统当前用户的.gradle文件夹下:C:\Users\{loginUser}\.gradle 设置gradle.properties,若无就新增。

在文件中添加如下配置信息:

org.gradle.jvmargs=-Xmx512m


问题二

导入含NDK的代码导致编译出错

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugNdk'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Program Files\Android\android-ndk-r10\ndk-build.cmd'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


解决方法:

在APP的build.gradle文件的Android结构体中新增:

sourceSets.main {
jni.srcDirs = []
}
ps: 网上也有说在jni目录中新建 xx.c文件,亲测依然不通过



问题三

svn版本控制-->import into subversion 报错

解决方法:

1. 安装TortoiseSVN

2. 设置中的如下三项全部取消勾选

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: