.
报错信息 :
-- Message Make :
Information:Compilation completed with 1 error and 0 warnings in 2 sec
Information:1 error
Information:0 warnings
Error:Android Source Generator: [MidiScope] AndroidManifest.xml file not found
-- Event Log :
上午8:41:38 Compilation completed with 1 error and 0 warnings in 2 sec
解决方案 :
-- 选择 右键点击工程, 选择 Open Module Settings :
-- 配置 AndroidManifest 路径 :
(1) 报错信息
报错信息 :
-- Message Make :
Information:Using javac 1.8.0_45 to compile java sources
Information:Compilation completed with 5 errors and 0 warnings in 3 sec
Information:5 errors
Information:0 warnings
/Users/hanshuliang/Downloads/MidiScope/Application/src/main/AndroidManifest.xml
Error:(27, -1) Android Resource Packaging: [MidiScope] /Users/hanshuliang/Downloads/MidiScope/Application/src/main/AndroidManifest.xml:27: error: Error: No resource found that matches the given name (at 'icon' with value '@mipmap/ic_launcher').
Error:(27, -1) Android Resource Packaging: [MidiScope] /Users/hanshuliang/Downloads/MidiScope/Application/src/main/AndroidManifest.xml:27: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(27, -1) Android Resource Packaging: [MidiScope] /Users/hanshuliang/Downloads/MidiScope/Application/src/main/AndroidManifest.xml:27: error: Error: No resource found that matches the given name (at 'theme' with value '@style/MidiScopeTheme').
Error:(33, -1) Android Resource Packaging: [MidiScope] /Users/hanshuliang/Downloads/MidiScope/Application/src/main/AndroidManifest.xml:33: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(48, -1) Android Resource Packaging: [MidiScope] /Users/hanshuliang/Downloads/MidiScope/Application/src/main/AndroidManifest.xml:48: error: Error: No resource found that matches the given name (at 'resource' with value '@xml/scope_device_info').
解决方案 :
-- 选择 右键点击工程, 选择 Open Module Settings :
-- 配置 资源路径 路径 :
报错信息 :
12-08 16:39:31.105 15700-15700/cn.zkhw.midi E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{cn.zkhw.midi/cn.zkhw.midi.slide.MainActivity}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2297)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2351)
at android.app.ActivityThread.access$700(ActivityThread.java:161)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1318)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:177)
at android.app.ActivityThread.main(ActivityThread.java:5426)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1225)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
at android.support.v7.app.AppCompatDelegateImplV7.setSupportActionBar(AppCompatDelegateImplV7.java:198)
at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:99)
at cn.zkhw.midi.slide.MainActivity.onCreate(MainActivity.java:28)
at android.app.Activity.performCreate(Activity.java:5372)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2259)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2351)?
at android.app.ActivityThread.access$700(ActivityThread.java:161)?
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1318)?
at android.os.Handler.dispatchMessage(Handler.java:99)?
at android.os.Looper.loop(Looper.java:177)?
at android.app.ActivityThread.main(ActivityThread.java:5426)?
at java.lang.reflect.Method.invokeNative(Native Method)?
at java.lang.reflect.Method.invoke(Method.java:525)?
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1225)?
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041)?
at dalvik.system.NativeStart.main(Native Method)?
12-08 16:39:32.815 15700-15700/cn.zkhw.midi I/Process: Sending signal. PID: 15700 SIG: 9
解决方案 :
-- 出错原因 : 使用 ToolBar 后, 原有的 ActionBar 没有取消, 两个导航栏都出现就出现了上述错误;
-- 设置一个 style :
--
将这个 style 设置给 Activity :
android
:theme=
"@style/AppTheme.NoActionBar"
报错信息 :
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':library:compileReleaseAidl'.
> aidl is missing
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.651 secs
解决方案 :
-- 错误原因 : SDK 文件不全, 换一个 SDk 重新编译即可通过;
-- 原来的 SDK 查看 : 右键点击工程, 选择 "Open Module Setting" ;
-- 编译设置 : 由此可见 22 5.1 的 SDK 是不完整的;
-- 更换 SDK 即可完成编译 : 注意 SDK 版本 和 编译工具的版本必须对应;
报错信息 :
Warning:Dependency AndroidQuickDevelop:lib_widget:unspecified on project app_sample resolves to an APK archive which is not supported as a compilation dependency. File: C:\hanshuliang\develop\workspace\as\AndroidQuickDevelop\lib_widget\build\outputs\apk\lib_widget-release-unsigned.apk
解决方案 :
-- 原来的 gradle 脚本 : 注意其中的 apply plugin 中的输出类型是 application, 另外在 defaultConfig 中有 applicationId.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "cn.org.octopus.lib_widget"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
-- 修改为 : 需要将 apply plugin 修改为 apply plugin: 'com.android.library' , 删除 applicationId, 下面的是修改完的 gradle 脚本, 修改完后即可编译.
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
报错信息 :
Error:Unable to find method 'org.gradle.api.internal.project.ProjectInternal.getPluginManager()Lorg/gradle/api/internal/plugins/PluginManagerInternal;'.
Possible causes for this unexpected error include:- Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
- The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
解决方案 :
-- 参考 : http://www.cnblogs.com/stozen/p/5123841.html;
-- 解决方案 : 将 gradle/wrapper/gradle-wrapper.properties 中的 distributionUrl 属性修改为 distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip;
报错信息 : 该问题总是在 Gradle 更新后出现, 原因可能是使用了 alpha 版本的 gradle 插件;
8:28:29 Gradle sync failed: Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "c1b9f8c9ba6edf57abf0bf0a680ecf1cd51bbfbe"
Consult IDE log for more details (Help | Show Log)
解决方案 :
-- 参考 : 点击打开链接;
-- 解决方案 : 去 https://jcenter.bintray.com/com/android/tools/build/gradle/ 网站查看最新的 Gradle 插件版本;
-- 转载资料 :
一、问题原理
其实问题也很明确,就是插件太老需要更新。
下面举个很好但是很久以前的例子,原理都是一样的:
This is my app gradle file:
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "xxx.xxxxxx.xxxxx"
versionCode 1
versionName '1'
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName '1'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:cardview-v7:21.0.0'
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
testCompile 'junit:junit:4.12'
compile project(':volley')
}
This is my top build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0-rc1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
1.上边的就是gradle版本太老
需要把:classpath 'com.android.tools.build:gradle:1.1.0-rc1'
change to:
classpath'com.android.tools.build:gradle:1.1.3'//latest 2.2.0-alpha1
现在gradle的版本已经更新到2.13啦。基本上就是gradle的问题。
2.App build.gradle:
Change:
compile'com.android.support:recyclerview-v7:21.0.0'
compile'com.android.support:cardview-v7:21.0.0'
To:
compile'com.android.support:recyclerview-v7:22.0.0'//latest23.1.1
compile'com.android.support:cardview-v7:22.0.0'//latest23.1.1
打开SDK Manager把依赖包也更新,一般更新到最新就可以啦。
下边是一些插件的网址:
Gradle: https://gradle.org/downloads
Always check the Android SDK Manager for the latest revisions:
Android Build Tools Plugin: http://tools.android.com/tech-docs/new-build-system
Android Support Libraries: http://developer.android.com/tools/support-library/features.html
To view the latest plugin releases, view the Bintray Jcenter page directly:https://bintray.com/android/android-tools/com.android.tools.build.gradle/view.
可以参考这个回答:http://stackoverflow.com/questions/29063968/plugin-is-too-old-please-update-to-a-more-recent-version-or-set-android-daily
二、更新gradle
这个更新gradle真的是很坑啊,百度了半天,倒是找到不少解决办法,但真的是很简洁!!!一些主要步骤都给省略啦,这让我这种新手怎么办!!在这里总结下:
这是离线更新,如果FQ在线更新的话也是一样的,在线更新就把下边的步骤1略过即可,从2开始看。
1.先去gradle官网把最新的gradle下下来,Gradle官网: https://gradle.org/downloads 注意:下载完不要解压!
2.在你的项目根目录下面找gradle/wrapper/gradle-wrapper.properties这个文件,修改里边的文件内容:
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip
就是改最后一行:distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip这个改为最新的版本,这里最新就是2.1我这是修改完的。
3.第三部很重要的一步,先打开你的Gradle 的user home ,默认是 C:\Users\【你当前的 用户名】 \.gradle 。按下图的路径展开,只是打开不要动任何东西
在Android Studio内置的终端:Terminal 如图:输入gradlew -v
执行这个命令会自动下载上边设置的版本:2.13,我这里已经下载完了,所以显示的是gradle 2.13。注意执行这个命令gradlew -v才会生成gradle-XXX-all和名字乱码的那个文件夹,我当时看别人的方法就很苦恼那个名字乱码的文件夹是怎么生成的!
执行后显示:Downloading distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip //大致就是这个,说明它正在下载,如果你想FQ在线更新就可以一直等它执行完毕,我试过FQ的情况下速度也是可以的
这时候你就注意上边打开的哪个文件夹,不断刷新看看是否生成了最新版本gradle的文件夹,有了这个文件夹就打开里边是一个名字是乱码文件夹,gradle-2.13-all\1b9wlm73elu4cqnbc0rk7r7qn//这个是我的
看到生成这个文件夹之后就可以关掉android studio了。
4.把第一步的压缩包复制到上边生成的乱码文件夹里,打开android studio,在Terminal里输入:gradlew -v,就会自动解压,你只需等待就可以。如图:
解压完成后:
至此你的gradle就更新到了最新版本。
可以参考这个:http://www.cnblogs.com/leo-lsw/p/gradle-first-created-error.html
搞了好久终于整明白这个问题啦,总结下希望能帮到和我一样的新手。。。。
转载注明出处:http://www.cnblogs.com/jycboy/p/5534009.html
三、更新Android Gradle Plugin
发现有时候更新了gradle但是gradle plugin版本也不可以。下面就改android plugin version
https://jcenter.bintray.com/com/android/tools/build/gradle/ android plugin version 改成最新的;
在android studio里project structrue->Project->Android Plugin Version里直接改成最新的,然后build Project就可以
参考知乎:http://www.zhihu.com/question/39036683/answer/91435802 //这个回答:都用最新的 就可以了 https://jcenter.bintray.com/com/android/tools/build/gradle/ android plugin version 改成最新的;Gradle Distributions gradle version 目前最新版本是2.12 手动下下来,放到本地,配置 gradle home
.
报错信息 :
Information:Gradle tasks [:APP_OCTOPUS:clean, :APP_OCTOPUS:generateDebugSources, :APP_OCTOPUS:mockableAndroidJar, :APP_OCTOPUS:prepareDebugUnitTestDependencies, :APP_OCTOPUS:generateDebugAndroidTestSources, :APP_OCTOPUS:assembleDebug]
Error:Execution failed for task ':APP_OCTOPUS:clean'.
> Unable to delete directory: C:\hanshuliang\develop\workspace\OCTOPUS\APP_OCTOPUS\build\outputs\apk
Information:BUILD FAILED
Information:Total time: 6.29 secs
Error:FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':APP_OCTOPUS:clean'.
> Unable to delete directory: C:\hanshuliang\develop\workspace\OCTOPUS\APP_OCTOPUS\build\outputs\apk
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Information:2 errors
Information:0 warnings
Information:See complete output in console
解决方案 :
-- 参考链接 : http://stackoverflow.com/questions/25051278/unable-to-clean-project-in-android-studio;
-- 到 windows 目录中删除该文件 : 发现无法删除, 直接用 360 强力删除 搞定, 芝麻大点问题;
.
报错信息 :
下午6:47:50 UnsupportedMethodException
Error executing task com.intellij.execution.impl.ExecutionManagerImpl$5@3f12ec8a: Unsupported method: AndroidArtifact.getInstantRun().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.
下午6:48:48 Executing tasks: [:app_midi_sheet_music:assembleDebug]
解决方案 :
-- 参考链接 : http://blog.csdn.net/piscesq329a/article/details/49945239;
-- 取消 Instant Run 选项 : 进入 Setting 进行如下设置 : 取消 Instant Run 选项;
报错信息 :
-- 错误信息 :
Error:Unable to find method 'org.gradle.api.tasks.Sync.getInputs()Lorg/gradle/api/internal/TaskInputsInternal;'.
Possible causes for this unexpected error include:
1.Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) 网络中断
-- Re-download dependencies and sync project (requires network)
2. The state of a Gradle build process (daemon) may be corrupt. 其它 Gradle 进程干扰
-- Stopping all Gradle daemons may solve this problem.
3. Stop Gradle build processes (requires restart) 重启 AS
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.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
解决方案 :
-- 解决方案 : 更新最新的 SDK Tools, Gradle, Gradle Plugin;
-- 更新最新 Gradle 插件 : 更新最新的 Gradle 插件, 到 https://jcenter.bintray.com/com/android/tools/build/gradle/ 网站查看最新的 Gradle 插件, 查询到最新的插件版本为 2.3.0-beta1,
-- 更新最新的 Gradle 工具 : 查看地址 https://services.gradle.org/distributions/, 最新的是 gradle-3.3-all.zip, 将 gradle/wrapper/gradle-wrapper.properties 中的 distributionUrl 更新成 distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip ;
-- 更新最新的 SDK Build Tools : 到 SDK Manager 中更新最新的 SDK 和 SDK BuildTools;
.
.