AS 编译问题解决方案汇总 (陆续添加总结...)
1.遇到“无法加载主类 org.gradle.wrapper.GradleWrapperMain”怎么解决?
解决:copy android/gradle/wrapper/gradle-wrapper.jar from other projects to the same location in ur [x\gradle\wrapper\]
2.Win7 x64 Android Studio无法识别手机 / adb interface有黄色感叹号
1. 在设备管理器中,找到ADB Interface,右击,选择“更新驱动程序软件”
2. 在弹出的窗口中选择第二项,也就是“浏览计算机以查找驱动程序软件” (以前遇到驱动的问题从来不考虑第二项,单纯地认为驱动肯定要在网上下而不是在windows中找)
3. 在弹出的窗口中继续选择第二项,也就是“从计算机的设备驱动程序列表中选择”
4. 在弹出的窗口中保持默认选择,点击“下一步”
5. 在弹出的窗口中选择“从磁盘安装”
在“从磁盘安装”对话框的“制造商文件复制来源”中,选择电脑上的Android SDK目录中的android_winusb.inf 文件,位置在 %SDK目录%\extras\google\usb_driver\android_winusb.inf
6. 选择android_winusb.inf路径并确定之后,在弹出的对话框中,选择第三项,也就是 “Android Composite ADB Interface”,然后点击“下一步”
7. 安装的过程中可能会出现一些警告信息,忽略,选择继续安装
8. 安装完毕
在设备管理器中,原来那个带黄色感叹号的 ADB Interface 消失了。
3.升级Gradle3.0报错:
Error:Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li><li>Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
解决:黄油刀8.6->8.4
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
3.Retrofit BaseUrl错误:
~ Channel is unrecoverably broken and will be disposed!
解决:注意端口号 和最后的斜杠
withApiHost("http://192.168.31.80:8080/RestServer/api/")
4.Android Studio全局搜索快捷键(Ctrl+Shift+F)失效的解决办法
焦点调整
可能你的焦点在下面的一排调试窗里,这种情况将焦点调到主界面即可
输入法冲突
可能在不同输入法下系统缓存区对输入的”Ctrl+Shift+F”的识别不同,这种情况下可以将输入法切换成系统默认的状态”Shift+Ctrl’或’Ctrl+command’均可
完。
5.Error running ***: Please select Android SDK” 运行按钮显示x
解决:https://blog.csdn.net/aqi00/article/details/78858336/
还可以改项目的File ->Project Structure->app->Source Compatibility/Target Compatibility 1.7
6.Error: Execution failed for task ':app:transformClassesWithDexForProductDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {
--dex--num - threads = 4--multi - dex--main - dex - list C: \ Project \ ph \ app \ build \ intermediates \ multi - dex \ product \ debug \ maindexlist.txt--output C: \ Project \ ph \ app \ build \ intermediates \ transforms \ dex \ product \ debug \ folders \ 1000 \ 1f \ main C: \ Project \ ph \ app \ build \ intermediates \ transforms \ jarMerging \ product \ debug \ jars \ 1 \ 1f \ combined.jar
}
解决:build.gradle
android{
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
7. As签名打包出现not found for signing config 'externalOverride'.
打包出现此问题,是因为jks路径错误,重新选择即可。