android studio使用说明

一.学习的基本配置文档,搞好各种参数的基本配置,熟练使用。
C:\Program Files\Java\jdk1.7.0_09\bin
 
二.problems meet in weather android studio:
1.代码不自动补全
解决方法:
Files ->Settings-> Editor -> Auto Import
代码报错时,按alt+enter可以自动修改丢失文件。
 
2.关于android studio的报错信息的具体函数查找
解决方法:看高亮的字体
at com.weathercast.MyActivity$PlaceholderFragment.onCreateView(MyActivity.java:117)
 
3.多个安卓设备连接电脑时,使用命令报错
adb remount 192.168.1.151:5555 error: more than one device and emulator
解决方法:
adb -s 192.168.1.151:5555 remount
 
4.修改工程的包名称
Right-click on the package name (src/com.android.gesture.builder).
Select Refactor > Rename and change the name, for example to com.android.gestureNEW.builder.
Open the manifest file. Inside the <manifest> tag, change the package name to com.android.gestureNEW.builder.
Open each of the two Activity files and do Ctrl-Shift-O to add missing import packages, then save each file. Run the GestureBuilder application on the emulator.
Right click on your project, scroll down to Android Tools, and then click on Rename Application Package.
 
5.常用注释
<!--注释-->
 
6.How to auto format code in eclipse?
把鼠标箭头移到出错误的layout上 点击鼠标右键选择Source然后再选Format
 
8.修改在AndroidManifest.xml中有个主activity的标签 里面那个label属性 修改运行就好
 
android studio 1.0rc
9.as最新版本V1.0打开老的工程报错
Error running app: Gradle project sync failed. Please fix your project and try again.
使用vpn修复了此问题
 
10.老的工程无法使用androidstudio运行,编译报错
Error:(16, 0) Gradle DSL method not found: 'runProguard()'
Possible causes:<ul><li>The project 'weathercastv3.01' may be using a version of Gradle that does not contain the method.
<a href="openGradleSettings">Gradle settings</a></li><li>The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>
 
11.问题adb server is out of date. killing...
adb nodaemon server
netstat -ano | findstr "5037"
tskill 4236
 
12.Error:The project is using an unsupported version of the Android Gradle plug-in (0.12.2). The recommended version is 0.14.4.
<a href="fixGradleElements">Fix plugin version and re-import project</a>
解决方法:使用vpn修复此问题
 
13.Error running app: Gradle project sync failed. Please fix your project and try again.
解决方法:使用vpn修复此问题
 
14.app图标无法打开,程序编译报错如下
Error:(16, 0) Gradle DSL method not found: 'runProguard()'
Possible causes:<ul><li>The project 'weathercastv3.01' may be using a version of Gradle that does not contain the method.
<a href="openGradleSettings">Gradle settings</a></li><li>The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>
解决方法:app/build.grade runProguard 改成 minifyEnabled,再按同步就可以了。
 
15.androidstudio添加文件夹
右键new->package就可以了
 
16.androidstudio adb报错
ADB not responding. If you'd like to retry, then please manually kill "adb.exe" and click 'Restart'
Errors from ADB:
adb: ADB server didn't ACK
adb: * failed to start daemon *
ddms: 'D:\system\sdk\platform-tools\adb.exe,start-server' failed -- run manually if necessary
拔插后正常。
 
17.缺少android的19api sdk
Error:Failed to find: com.android.support:appcompat-v7:21.+
<a href="install.m2.repo">Install Repository and sync project</a><br><a href="openFile">Open File</a><br><a href="open.dependency.in.project.structure">Open in Project Structure dialog</a>
解决方法:
Loading SDK information...
Refresh Sources:
Fetched Add-ons List successfully
Refresh Sources
使用vpn成功下载资源文件
 
18.缺少
Error:failed to find target android-19 : D:\system\sdk\android-sdk_r23.0.5-windows\android-sdk-windows
<a href="install.android.platform">Install missing platform(s) and sync project</a>
解决方法:使用vpn成功下载资源文件
 
19.缺少文件
Error:failed to find Build Tools revision 20.0.0
<a href="install.build.tools">Install Build Tools 20.0.0 and sync project</a>
解决方法:使用vpn成功下载资源文件
 
20.why ftp android can't work?
Error:Gradle version 1.10 is required. Current version is 2.2. If using the gradle wrapper, try editing the distributionUrl in
E:\androidlearn\ftp\sun3\gradle\wrapper\gradle-wrapper.properties to gradle-1.10-all.zip.
Please fix the project's Gradle settings.
<a href="openGradleSettings">Gradle settings</a>
解决方法:no
 
21.
Gradle version 1.10 is required. Current version is 2.2. If using the gradle wrapper, try editing the distributionUrl in
E:\androidlearn\ftp\sun3\app\gradle\wrapper\gradle-wrapper.properties to gradle-1.10-all.zip.
Please fix the project's Gradle settings.Consult IDE log for more details (Help | Show Log)
解决方法:no
 
22.
Could not read script 'E:\androidlearn\ftp\transdroid\signing.gradle' as it does not exist.
Consult IDE log for more details (Help | Show Log)
解决方法:no
 
23.
Gradle version 1.10 is required. Current version is 2.0. If using the gradle wrapper, try editing the distributionUrl in E:\androidlearn\ftp\transdroid\app\gradle\wrapper\gradle-wrapper.properties to gradle-1.10-all.zip.
Please fix the project's Gradle settings.Consult IDE log for more details (Help | Show Log)
 
24.
Cannot start compilation: the output path is not specified for module "app".
Specify the output path in Configure Project.
 
25.
Gradle version 1.10 is required. Current version is 2.0. If using the gradle wrapper, try editing the distributionUrl in E:\androidlearn\ftp\sun1\app\gradle\wrapper\gradle-wrapper.properties to gradle-1.10-all.zip.
Please fix the project's Gradle settings.
Consult IDE log for more details (Help | Show Log)
26.
Ambiguous method overloading for method java.io.File#<init>.
Cannot resolve which method to invoke for [null, class java.lang.String] due to overlapping prototypes between:
[class java.lang.String, class java.lang.String]
[class java.io.File, class java.lang.String]
 
Consult IDE log for more details (Help | Show Log)
 
27.
8:15:42 IllegalStateException: Cannot locate factory for objects of type DefaultGradleConnector, as ConnectorServiceRegistry has been closed.: Cannot locate factory for objects of type DefaultGradleConnector, as ConnectorServiceRegistry has been closed.
Cannot locate factory for objects of type DefaultGradleConnector, as ConnectorServiceRegistry has been closed.: Cannot locate factory for objects of type DefaultGradleConnector, as ConnectorServiceRegistry has been closed.
java.lang.IllegalStateException: Cannot locate factory for objects of type DefaultGradleConnector, as ConnectorServiceRegistry has been closed.
at org.gradle.internal.service.DefaultServiceRegistry.getFactory(DefaultServiceRegistry.java:310)
at org.gradle.tooling.internal.consumer.ConnectorServices.createConnector(ConnectorServices.java:36)
at org.gradle.tooling.GradleConnector.newConnector(GradleConnector.java:64)
at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.getConnection(GradleExecutionHelper.java:300)
at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:201)
at com.android.tools.idea.gradle.invoker.GradleTasksExecutor.invokeGradleTasks(GradleTasksExecutor.java:402)
at com.android.tools.idea.gradle.invoker.GradleTasksExecutor.run(GradleTasksExecutor.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:471)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:380)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:419)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:149)
 
28.The project is using an unsupported version of Gradle.
Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)
 
29.SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
 
 
30.同一个project导入多个module,遇到此问题Already disposed: Module:
 
31.androidstudio如何开多个窗口,打开多个工程?
解决方法:使用file->open->选择工程->提示是否使用新窗口打开。
 
32.mavenCentral()与jcenter()究竟有什么差别/
待查明
 
33.FTP代码无法编译。
解决方法:a.修改E:\androidlearn\ftp\sun1\build.gradle
classpath 'com.android.tools.build:gradle:0.12.+'为 classpath 'com.android.tools.build:gradle:0.14.4'
b.修改E:\androidlearn\ftp\sun1\gradle\wrapper\gradle-wrapper.properties
distributionUrl=http\://services.gradle.org/distributions/gradle-2.0-all.zip
改为distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
posted @ 2015-10-30 16:19  lianghe  阅读(2574)  评论(0编辑  收藏  举报