android gradle 和gradle plugin
android gradle 和gradle plugin
1、安装完AS3.5.2创建完项目一运行,报了如下错误
Error:Could not find com.android.tools.build:gradle:4.1. Searched in
the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.jar
https://repo1.maven.org/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.jar
https://littlefogcat.top/example/com/android/tools/build/gradle/4.1
问题分析:
首先想到的是去看看我的grid : File =>Settings =>gradle
发现我gradle的是存在的
那么去看看项目的gridle版本:File=>project structure =>project 查看,发现我的
Android Gradle Plugin Version 版本和我的插件版本都是4.1
按理说因该没问题的啊,
但是实际是这样的么?
回到问题本身,再去看看错误提示信息没有找到C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.jar
再去他给的下载地址去看看,发现目前为止最新版本的gradle是2.3.0
好吧,那就把我的gradle plugin版本改为2.3.0
问题解决:
把我的gradle plugin版本改为2.3.0
2、新问题来了:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$(LifecycleProjectEvaluator.java:)
at org.gradle.configuration.project.LifecycleProjectEvaluator$.execute(LifecycleProjectEvaluator.java:)
at org.gradle.configuration.project.LifecycleProjectEvaluator$.execute(LifecycleProjectEvaluator.java:)
at org.gradle.internal.Transformers$.transform(Transformers.java:)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:)
at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:)
at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuildAction.execute(DefaultGradleLauncher.java:)
at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuildAction.execute(DefaultGradleLauncher.java:)
at org.gradle.internal.Transformers$.transform(Transformers.java:)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:)
at org.gradle.initialization.DefaultGradleLauncher.getBuildAnalysis(DefaultGradleLauncher.java:)
at org.gradle.launcher.exec.GradleBuildController.configure(GradleBuildController.java:)
at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:)
at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$.execute(RunAsBuildOperationBuildActionRunner.java:)
at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$.execute(RunAsBuildOperationBuildActionRunner.java:)
at org.gradle.internal.Transformers$.transform(Transformers.java:)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:)
at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:)
at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$.call(ForwardClientInput.java:)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$.call(ForwardClientInput.java:)
at org.gradle.util.Swapper.swap(Swapper.java:)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$.run(StartBuildOrRespondWithBusy.java:)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$.run(DaemonStateCoordinator.java:)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:)
at org.gradle.internal.concurrent.StoppableExecutorImpl$.run(StoppableExecutorImpl.java:)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:)
at java.lang.Thread.run(Thread.java:)
Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$.run(DefaultScriptPluginFactory.java:)
at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:)
... more
Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method implementation() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
at org.gradle.internal.metaobject.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:)
at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:)
at build_cwcqry1dtacujy4w7qkivl3cy$_run_closure2.doCall(D:\Android\UIautoApplication\app\build.gradle:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:)
at groovy.lang.Closure.call(Closure.java:)
at groovy.lang.Closure.call(Closure.java:)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:)
at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:)
at org.gradle.api.internal.project.DefaultProject.dependencies(DefaultProject.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:)
at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:)
at org.gradle.internal.metaobject.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:)
at org.gradle.internal.metaobject.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:)
at org.gradle.internal.metaobject.MixInClosurePropertiesAsMethodsDynamicObject.invokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:)
at org.gradle.groovy.scripts.BasicScript.invokeMethod(BasicScript.java:)
at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:)
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:)
at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:)
at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:)
at build_cwcqry1dtacujy4w7qkivl3cy.run(D:\Android\UIautoApplication\app\build.gradle:)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:)
... more
问题分析:gradle版本过低,不支持c....需要升级到3.0以上的版本
android gradle 和gradle plugin的更多相关文章
- Failed to apply plugin [id 'com.android.application'] 和 Could not find com.android.tools.build:gradle:2.XX的最正确的解决方法
发现android studio是真的可爱啊,上一秒还没问题可以build运行,下一秒就出错...好,你任性,你牛逼.. 说下今天又遇到的两个问题:Failed to apply plugin [id ...
- Gradle、Gradle Wrapper与Android Plugin for Gradle
欢迎和大家交流技术相关问题: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://g ...
- 彻底搞懂Gradle、Gradle Wrapper与Android Plugin for Gradle的区别和联系
首先用一段通俗易懂但是不是非常专业的话描述一下三者的概念.区别和联系. Gradle是个构建系统,能够简化你的编译.打包.测试过程.熟悉Java的同学,可以把Gradle类比成Maven. Gradl ...
- Android Gradle插件(plugin)版本(version)与Gradle、SDK Build Tools版本关系
具体关系如下图: 比如,Android Studio 2.0发布,其中有个新功能“Instant Run”,需要Android Gradle Plugin版本2.0.0以上,那么我们项目的.gradl ...
- 使用Android Studio和Gradle编译NDK项目之Experimental Plugin User Guide
转载自:http://tools.android.com/tech-docs/new-build-system/gradle-experimental Introduction The new exp ...
- Android studio 使用Gradle发布Android开源项目到JCenter 总结
1.注册账号 先到https://bintray.com注册一个账号. 这个网站支持 github 账户直接登录的 2.获取 bintray.user 和 bintray.apikey ...
- Android studio下gradle Robolectric单元测试配置
android studio下gradle Robolectric单元测试配置 1.Robolectric Robolectric是一个基于junit之上的单元测试框架.它并不依赖于Android提供 ...
- android studio 使用gradle 导出jar包,并打包assets目录
警告:本文年久失修. 随着android studio的升级 ,gradle的升级,严格按照本文的代码去做可能不会成功,希望依然可以作为解决问题的思路. 最近项目在做一个sdk,供别的开发者使用,所以 ...
- Android Studio :Android Studio 与 Gradle 深入【二】
转载:http://www.apkbus.com/forum.php?mod=viewthread&tid=255063&extra=page%3D2%26filter%3Dautho ...
随机推荐
- thinkphp助手函数
tp3 C($name=null, $value=null,$default=null) 获取和设置配置参数 支持批量定义 load_config($file,$parse=CONF_PARSE) 加 ...
- [学习笔记]最小割树(Gomory-Hu Tree)
最小割树(\(\mathcal{Gomory-Hu Tree}\))简明指南 对于单源最短路径,我们有\(SPFA\)和\(Dijkstra\),对于多源最短路径,我们有\(Floyd\):对于两点间 ...
- Oracle使用——PLSQL的中文乱码显示全是问号--Oracle查询中文乱码
问题 这两天刚将PLSQL与Oracle配置好,可是在PLSQL中插入数据时,出现一个问题,PLSQL中的表里无法显示中文,中文无法保存.无法输出,中文在表中显示问号,如图: 原因 经过一番查证, ...
- leetcood学习笔记-226- 翻转二叉树
题目描述: 第一次提交: class Solution(object): def invertTree(self, root): """ :type root: Tree ...
- bzoj1001题解
[解题思路] 显然,这题的答案是这个网格图的最小割.根据最大流-最小割定理,我们可以用网络流算法来求其最小割,时间复杂度最小为O(V2√E). 特殊的,这个网格图是一个平面图,于是可以根据平面图最小割 ...
- 二分图染色+分组背包+bitset优化——hdu5313
首先就是求联通块,每个联通块里记录两个部分的元素个数 目标是使一边的体积接近n/2 那么每个联通块作为一组,进行分组背包,dp[i]表示体积i是否可以被凑出来,可行性背包是可以用bitset优化的 最 ...
- (转)C++实现RTMP协议发送H.264编码及AAC编码的音视频,摄像头直播
转:http://www.cnblogs.com/haibindev/archive/2011/12/29/2305712.html C++实现RTMP协议发送H.264编码及AAC编码的音视频 RT ...
- LeetCode 746. Min Cost Climbing Stairs (使用最小花费爬楼梯)
题目标签:Dynamic Programming 题目给了我们一组 cost,让我们用最小的cost 走完楼梯,可以从index 0 或者 index 1 出发. 因为每次可以选择走一步,还是走两步, ...
- 中断控制及basepri 与 basepri_max
1.总开关 每个CPU有一个中断总开关.通过CPU中断控制寄存器实现.Cortex-M的中断控制寄存器包括:FAULTMASK.PRIMASK.BASEPRI.BASEPRI_MAX.总开关的本质是变 ...
- Day 9 :初识函数
Python函数:1.函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 2.函数能提高应用的模块性,和代码的重复利用率. Python提供了许多内建函数,比如print().但你也可 ...