使用AndroidStudio出现的一些问题及解决办法

经常从github上down下来一些工程,但是因为as版本问题,导致很多因为as版本原因导致的错误,下面记载我发现的一些问题和解决办法,会一直更新

1.Gradle
DSL method not found: ‘runProguard()‘

解决办法:

更改项目build.gradle参数

old:

<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit;"><span style="font-size:14px;"><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;">buildTypes </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;">{</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;">
    release </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;">{</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;">

        <span style="color: rgb(255, 0, 0);">runProguard </span></span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;"><span style="color: rgb(255, 0, 0);">false</span></span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;"> </span><span class="com" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; color: rgb(128, 128, 128); background: transparent;">// 已经被废弃并且停止使用了</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;">

        ......</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;">
    </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;">}</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;">
</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background: transparent;">}</span></span></code>

new:

<code style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit;"><span style="font-size:14px;"><span class="pln" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">buildTypes </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">{</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">
    release </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">{</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">

        <span style="color: rgb(255, 0, 0);">minifyEnabled </span></span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"><span style="color: rgb(255, 0, 0);">false</span></span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"> </span><span class="com" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; color: rgb(128, 128, 128); background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">// 替代的方式</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">

        ......</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">
    </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">}</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">
</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-color: transparent; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">}</span></span></code>

2.Could not
find property ‘processResources‘
  ---xxxxxxxxx

解决办法:

android studio1.0.2中的gradle需使用gradle2.2.1的版本,在导入以前的project或者新的project配置APP目录下的build.gradle时,可能会遇到以下错误:Could not find property ‘processResources‘ on com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated,而这个错误所指向的地方是配置文件的"androidManifestFile
variant.processResources.manifestFile",这种错误是由于gradle的版本引起的,在新版本的gradle中的写法为:androidManifestFile variant.outputs[0].processResources.manifestFile,添加红色部分就能解决问题了。

时间: 2024-10-30 17:43:09

使用AndroidStudio出现的一些问题及解决办法的相关文章

AndroidStudio运行项目出现Unsupported method: AndroidProject.getPluginGeneration()错误解决办法

一.错误描述 今天在使用AndroidStudio运行项目时出现了一个Unsupported method: AndroidProject.getPluginGeneration()错误,如下图所示: 二.解决办法 第一次遇到这个错误,上网找了一下解决办法,解决办法如下: 关掉instant run即可,如下图所示: 关掉[instant run]就可以解决上述所说的Unsupported method: AndroidProject.getPluginGeneration()错误,总感觉这种解

Androidstudio中Rendering Problems不能可视化操作的解决办法

出现:Rendering Problems the following classes could not be found:android.support.v7.internal.widget.ActionBarOverlayLayout (Fix Build Path, Edit XML, Create Class) Tip: Try to build the project不能显示图形化界面 解决办法: style文件中theme改一下 在Theme.AppCompat.Light.Dar

安卓应用方法数超过64k解决办法:分割Dex

你的安卓项目功能很强大,对接了好多第三方开源库,项目越做越完善,代码越敲越爽.可是突然有一天报异常了. 错误:The number of method references in a .dex file cannot exceed 64K. 编译器提醒你,你的项目方法数超过64k了. AndroidStudio会提醒你: Learn how to resolve this issue at https://developer.android.com/tools/building/multidex

关于android studio 出现Error:Execution failed for task &#39;:app:buildInfoDebugLoader&#39;.的解决办法

今天在使用androidstudio的过程中,改了代码点击运行的时候发现android studio总是报 Error:Execution failed for task ':app:buildInfoDebugLoader'.> Exception while doing past iteration backup : Source /home/ruiqin/AndroidStudioProjects/DouTuGaoShou/app/build/intermediates/builds/de

Android性能优化之Systrace工具介绍(一) _&amp;&amp; Systrace生成的trace.html打开空白或者打不开的解决办法

1.必须用Chrome打开 2.在mac电脑上,可能Chrome打开也是空白,解决办法是:在chrome地址栏中输入”chrome:tracing”,然后点击load按钮load你的trace.html文件. Systrace简单介绍 Systrace是Android4.1中新增的性能数据采样和分析工具.它可帮助开发者收集Android关键子系统(如surfaceflinger.WindowManagerService等Framework部分关键模块.服务,View系统等)的运行信息,从而帮助开

java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0解决办法

androidstudio编译程序时出现java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0.Unsupported major.minor version 52.这个错误是由于(jdk)高版本的java project使用了低版本的来运行.使用命令(java -version 和 javac -version)查看java

Android Stduio 发生 Process &#39;command &#39;somePath:java.exe&#39;&#39; finished with non-zero exit value 2 异常的解决办法

有时你会发现,在你使用Android Studio 进行编译的时候提示: Error:Execution failed for task ':demo:dexDebug'.> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'java.exe'' finished with non-zero exit value 2 为什么会这

如何用 Android Studio 导入开源项目以及常见错误的解决办法

声明:这篇文章完全来自这篇文章,感谢大神的相助.这篇文章纯粹是为了备份. 本篇以Github上最热门的MaterialDesign库,MaterialDesignLibrary来介绍怎样使用Android Sudio导入开源项目的,如果你和我一样刚刚从Eclipse转到AS,那本篇文章非常适合你. 如果不引入任何第三方库,不做自动化分渠道打包等操作,那可以在完全不了解Gradle的情况下进行Android项目的开发.但如果要想导入Github上的热门项目,必须首先熟悉Gradle. 1. Gra

phpstudy无法访问主页,提示You don&#39;t have permission to access / on this server解决办法

1.输入localhost提示:You don't have permission to access / on this server. 新版phpStudy为了安全,取消Apache和nginx列出目录内容. phpStudy如何禁止或允许站点目录列表 请使用『其他选项菜单』-『phpStudy设置』-『允许目录列表』,打上对勾表示允许目录列表,去掉对勾表示禁止目录列表. 2.配置多域名的虚拟主机总是失败,提示You don't have permission to access / on