ubuntu Android Studio

1.Android Studio安装错误

按照Android官网的安装方法点击打开链接, 出现如下错误:

Exception in thread "main" java.awt.HeadlessException: Unable to detect graphics environment
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
	at com.intellij.idea.Main.main(Main.java:68)

在网上搜索了下, 说在启动前执行:

export  DISPLAY=localhost:0
试了试还真可以!

参考资料:

http://blog.csdn.net/superch0054/article/details/9719217

2.SVN导入有问题

从服务器上面ckeck下来的工程,无法构建成功。折腾很久,最后重新打开空的AS,File-> New -> Import Project...,找到ckeck下来的工程,重新导入。OK!

3.自定义类似eclipse的templates

在setting-->Live Templates,定义自己的template

ref:

http://www.cnblogs.com/baron89/p/4668053.html

http://ask.android-studio.org/?/question/217


4.错误

AAPT: xx/app/src/main/res/drawable-hdpi/btn_click.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

Error:Execution failed for task ':app:mergeDebugResources'.
> Some file crunching failed, see logs for details

解决:把工程父级的build.gradle的classpath 'com.android.tools.build:gradle:1.5.0'降级为classpath 'com.android.tools.build:gradle:1.3.0',并把gradle-2.8换成gradle-2.4.


5.Android Studio 2.2错误,使用AS中的ndk来代替命令行的ndk编译jni,按照官网配置之后,一直报以下错误:

Error:11:42:47.746 [ERROR] [org.gradle.api.Project] make: *** 空变量名。 停止。

11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter] 
11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter] 
11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':xx:externalNativeBuildRelease'.
11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter] > Build command failed.
11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter]   Error while executing '~/tools/android_tools/sdk/ndk-bundle/ndk-build' with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=~/xx/src/main/jni/Android.mk NDK_APPLICATION_MK=xx/src/main/jni/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a ...}
11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter]   make: *** 空变量名。 停止。
11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter] 
11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter] 
11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
11:42:47.750 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. 
折腾了1个多小时后,原来是配置中多了空格。。。。。。

arguments "NDK_APPLICATION_MK := src/main/jni/Application.mk"
符号
:=
前后都不能有空格,我加空格只是为了好看,却。。



你可能感兴趣的:(环境搭建)