【错误记录】Android Studio 配置 AspectJ 报错 ( all buildscript {} blocks must appear before any plugins {} )

简介: 【错误记录】Android Studio 配置 AspectJ 报错 ( all buildscript {} blocks must appear before any plugins {} )

文章目录

一、报错信息

二、解决方案





一、报错信息


在 Android Studio 配置 AspectJ 报错 :


Build file 'D:\002_Project\002_Android_Learn\AOP_Demo\app\build.gradle' line: 5
Could not compile build file 'D:\002_Project\002_Android_Learn\AOP_Demo\app\build.gradle'.
> startup failed:
  build file 'D:\002_Project\002_Android_Learn\AOP_Demo\app\build.gradle': 5: all buildscript {} blocks must appear before any plugins {} blocks in the script








二、解决方案


错误原因 : 在 Module 下的 build.gradle 中 , 进行了如下配置 ;


plugins {
    id 'com.android.application'
}
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.aspectj:aspectjtools:1.8.10'
        classpath 'org.aspectj:aspectjweaver:1.8.10'
    }
}
android {
}
...


Gradle 配置中要求 , buildscript {} 配置必须在所有的 plugins {} 配置之前 ;



修改方案一 : 将 buildscript 配置放在脚本的最前面 ;


buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.aspectj:aspectjtools:1.8.10'
        classpath 'org.aspectj:aspectjweaver:1.8.10'
    }
}
plugins {
    id 'com.android.application'
}



修改方案二 : 将


plugins {
    id 'com.android.application'
}


配置 , 修改为 :


apply plugin: 'com.android.application'


最终效果为 :


apply plugin: 'com.android.application'
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.aspectj:aspectjtools:1.8.10'
        classpath 'org.aspectj:aspectjweaver:1.8.10'
    }
}
目录
相关文章
|
开发工具 Android开发 iOS开发
如何在Android Studio中配置Flutter环境?
如何在Android Studio中配置Flutter环境?
3484 160
|
Android开发 Windows
Android studio 报错Connect to 127.0.0.1:8888 [/127.0.0.1] failed: Connection refused: connect(已解决)
这是一篇关于解决Android Studio报错“Connect to 127.0.0.1:8888 failed: Connection refused”的文章。问题通常因系统代理设置被Android Studio自动保存导致。解决方法是找到系统中Android Studio使用的gradle.properties文件(位于Windows的C:\Users\你的电脑用户名\.gradle或Mac的/Users/.{你的用户目录}/.gradle),删除或注释掉多余的代理配置后保存并重新Sync项目。希望此经验能帮助快速解决同类问题!
3584 36
|
Java Android开发
Android studio中build.gradle文件简单介绍
本文解析了Android项目中build.gradle文件的作用,包括jcenter仓库配置、模块类型定义、包名设置及依赖管理,涵盖本地、库和远程依赖的区别。
1339 19
|
Dart 前端开发 Android开发
【09】flutter首页进行了完善-采用android studio 进行真机调试开发-增加了直播间列表和短视频人物列表-增加了用户中心-卓伊凡换人优雅草Alex-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
【09】flutter首页进行了完善-采用android studio 进行真机调试开发-增加了直播间列表和短视频人物列表-增加了用户中心-卓伊凡换人优雅草Alex-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
796 4
【09】flutter首页进行了完善-采用android studio 进行真机调试开发-增加了直播间列表和短视频人物列表-增加了用户中心-卓伊凡换人优雅草Alex-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
|
Android开发
【错误记录】Android Studio 编译报错 ( Installed Build Tools revision 31.0.0 is corrupted )
【错误记录】Android Studio 编译报错 ( Installed Build Tools revision 31.0.0 is corrupted )
1692 0
【错误记录】Android Studio 编译报错 ( Installed Build Tools revision 31.0.0 is corrupted )
|
数据可视化 开发工具 Android开发
【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read | 使用命令行提交代码 )
【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read | 使用命令行提交代码 )
645 0
【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read | 使用命令行提交代码 )
|
Android开发
【错误记录】Android Studio 编译报错 ( Error:Connection timed out: connect | 更新配置依赖仓库方式 )
【错误记录】Android Studio 编译报错 ( Error:Connection timed out: connect | 更新配置依赖仓库方式 )
1460 0
【错误记录】Android Studio 编译报错 ( Error:Connection timed out: connect | 更新配置依赖仓库方式 )
|
XML 缓存 IDE
解决Android Studio报错:Compilation is not supported for following modules
本文主要解决和"Compilation is not supported for following modules"有关的报错。
2737 0
解决Android Studio报错:Compilation is not supported for following modules
|
Android开发
【错误记录】Android Studio 配置 GitHub 报错 ( Can‘t login using given credentials: Request response: 401 Una )
【错误记录】Android Studio 配置 GitHub 报错 ( Can‘t login using given credentials: Request response: 401 Una )
729 0
【错误记录】Android Studio 配置 GitHub 报错 ( Can‘t login using given credentials: Request response: 401 Una )
|
Android开发
android studio 重新将module中的代码加入到自己项目中,报错找不到SO文件。
android studio 重新将module中的代码加入到自己项目中,报错找不到SO文件。

热门文章

最新文章