Android Studio问题汇总

1、git.exe问题

今天用android studio从git下载项目的时候遇到一个问题,提示说Can't run Git: git.exe。下了一个git windows版本后,在studio的设置里面有一个设置。 java

设置git.exe的路径为本地的有效路径,点击apply后,搞定。 android

 

2、attach source code

android studio貌似有个bug,若是第一次设置的SDK路径里不包含source,那么后期使用SDK Manager下载了source后,仍是没法查看。 git

解决办法: windows

一、close all project

    具体close方法:File -> Close Project android-studio

二、Welcome to Android Studio screen, go to Configure > Project Defaults > Project Structure > SDKs

从新选择SDK路径,固然咱们能够选择上次的路径 app

三、从新打开project

说明:在从新设置上次的SDK路径后,再次打开项目就有source code了。 ide

若是还不行的话,能够参考下面的方法: gradle

  • Close all open projects
  • From the Welcome to Android Studio screen, go to Configure > Project Defaults > Project Structure > SDKs
  • Choose the appropriate Android API SDK that you installed source for, and go to Sourcepathpanel
  • Press the + button, and choose the source directory.

或者 ui

Another approach would be to blow away all of Android Studio's auto-created SDKs and let it rebuild them. To do that google

  • Exit Android Studio
  • Delete the jdk.table.xml file, which on MacOS will be in your home directory underLibrary/Preferences/AndroidStudioPreview
  • Relaunch Android Studio
  • Go into Project Structure (either from the Welcome screen or from a project), and choose theAndroid SDK tab
  • Make sure the Android SDK location and JDK location are correct.

 

3、Google Play商店没法上传应用

提示上传了可调试 APK文件。因为使用的是studio开发,一度怀疑是gradle的问题。后来发现是依赖的第三方库在manifest.xml文件定义了debugger=true,坑爹!

 

4、导入其余样式设置文件

File - Import Settings

 

5、检查更新失败

升级时提示 Connection failed. Please check your network connection and try again

修改安装目录下bin\studio.exe.vmoptions文件,如E:\Android\android-studio\bin\studio.exe.vmoptions

若是是64位系统,那就应该修改bin\studio64.exe.vmoptions文件

-Djava.net.preferIPv4Stack=true
-Didea.updates.url=http://dl.google.com/android/studio/patches/updates.xml
-Didea.patches.url=http://dl.google.com/android/studio/patches/

 

6、debug模式没法运行

编译提示:

android studio execution failed for task dexdebug...

输入行太长...

等等语句

解决:

怀疑是依赖的项目有问题,仔细检查发现依赖的一个项目library-a里面有

dependencies {
    compile 'com.android.support:support-v4:13.0.0'
    compile 'com.android.support:gridlayout-v7:21.0.3'
}



 

实际上这个库里面又没有用到gridlayout,也就是说第二个depend是无效的,删掉

 
相关文章
相关标签/搜索