2013-06-21 48 views
17

Trong Google IO, hệ thống xây dựng mới gradle được công bố để thay thế kiến. Dự án của tôi đang sử dụng aspectj và tôi muốn sử dụng nó trong dự án của mình. Tôi không thể tìm ra một số biến để làm cho nó hoạt động. Tôi không tìm thấy classpath đầu ra android. * Ở đó. Bất cứ ai cũng có thể giúp đỡ?Hệ thống xây dựng mới của Android (gradle) và aspectj

Đây là build.gradle hiện tại của tôi:

buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:0.4' 
    } 
} 
apply plugin: 'android' 
sourceCompatibility = 1.6 

configurations { 
    ajc 
} 

dependencies { 
    compile fileTree(dir: 'libs', includes: ['*.jar']) 
    ajc files('build-tools/aspectjtools.jar', 'libs/aspectjrt.jar') 
} 

android { 
    compileSdkVersion 16 
    buildToolsVersion "17" 

    defaultConfig { 
     minSdkVersion 8 
     targetSdkVersion 16 
    } 
    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
     } 

     instrumentTest.setRoot('test') 
    } 
} 

gradle.projectsEvaluated { 
    compileJava.doLast { 
     tasks.compileAspectJ.execute() 
    } 
    println 'lalalalala' 
} 

task compileAspectJ { 

    ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", 
     classpath: configurations.ajc.asPath) 
    ant.iajc(source: sourceCompatibility, target: sourceCompatibility, 
     destDir: "?????????????????????", 
     classpath: "????????????????????????????") { 

     sourceroots{ 
      android.sourceSets.main.java.srcDirs.each { 
       pathelement(location: it.absolutePath) 
      } 
     } 
    } 
} 

Đây là mã ant cũ mà hoạt động rất tốt: http://code.google.com/p/anymemo/source/browse/custom_rules.xml

Edit:

Cập nhật các build.gradle theo Câu trả lời đầu tiên.Tuy nhiên tôi iajc dường như không nhận ra tất cả các thư viện và khiếu nại các lớp học trong các thư viện không được tìm thấy

buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:0.5.+' 
    } 
} 

apply plugin: 'android' 
sourceCompatibility = 1.6 
targetCompatibility = 1.6 

repositories { 
    mavenCentral() 
} 

android { 
    compileSdkVersion 18 
    buildToolsVersion "18.1.0" 

    defaultConfig { 
     minSdkVersion 9 
     targetSdkVersion 16 
    } 
    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
     } 

     // Move the tests to tests/java, tests/res, etc... 
     instrumentTest.setRoot('tests') 

     // Move the build types to build-types/<type> 
     // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
     // This moves them out of them default location under src/<type>/... which would 
     // conflict with src/ being used by the main source set. 
     // Adding new build types or product flavors should be accompanied 
     // by a similar customization. 
     debug.setRoot('build-types/debug') 
     release.setRoot('build-types/release') 
    } 
} 

configurations { 
    ajc 
    aspects 
    ajInpath 
} 

ext.aspectjVersion = '1.7.3' 

dependencies { 
    compile fileTree(dir: 'libs', include: '*.jar') 

    ajc "org.aspectj:aspectjtools:${aspectjVersion}" 
    compile "org.aspectj:aspectjrt:${aspectjVersion}" 
    compile 'com.android.support:appcompat-v7:18.0.0' 
} 

android.applicationVariants.all { variant -> 

    variant.javaCompile.doLast { 
     def androidSdk = android.adbExe.parent + "/../platforms/" + android.compileSdkVersion + "/android.jar" 
    println 'AAAAAAAAAAAAAAAAA: ' + androidSdk 

     def iajcClasspath = configurations.compile.asPath + ":" + androidSdk 
     configurations.compile.dependencies.each { dep -> 
      if(dep.hasProperty("dependencyProject")) { 
       iajcClasspath += ":" + dep.dependencyProject.buildDir + "/bundles/release/classes.jar" 
      } 
     } 
    println 'BBBBBBBBBBBBBB : ' + iajcClasspath 

     ant.taskdef(resource:"org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.ajc.asPath) 
     ant.iajc (
       source:sourceCompatibility, 
       target:targetCompatibility, 
       destDir:"${project.buildDir}/classes/${variant.dirName}", 
       maxmem:"512m", 
       fork:"true", 
       aspectPath:configurations.aspects.asPath, 
       inpath:configurations.ajInpath.asPath, 
       sourceRootCopyFilter:"**/.svn/*,**/*.java", 
       classpath:iajcClasspath 
     ){ 
      sourceroots{ 
       android.sourceSets.main.java.srcDirs.each{ 
        pathelement(location:it.absolutePath) 
       } 
       pathelement(location:"${project.buildDir}/source/r/${variant.dirName}") 
      } 
     } 
    } 
} 

Lỗi:

1 [error] The method onPrepareOptionsMenu(Menu) of type FingerPaint must override or impl[3780/18642] 
rtype method 
[ant:iajc] public boolean onPrepareOptionsMenu(Menu menu) { 
[ant:iajc]    ^^^^^^^^^^^^^^^^^^^^^^^^^^ 
[ant:iajc] /home/liberty/mp/android/AnyMemo/src/com/example/android/apis/graphics/FingerPaint.java:21 
2 [error] The method onPrepareOptionsMenu(Menu) is undefined for the type GraphicsActivity 
[ant:iajc] super.onPrepareOptionsMenu(menu); 
[ant:iajc]  ^^^^^^^^^^^ 
[ant:iajc] /home/liberty/mp/android/AnyMemo/src/com/example/android/apis/graphics/FingerPaint.java:21 
7 [error] The method onOptionsItemSelected(MenuItem) of type FingerPaint must override or implement a 
supertype method 
[ant:iajc] public boolean onOptionsItemSelected(MenuItem item) { 
[ant:iajc]    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
[ant:iajc] /home/liberty/mp/android/AnyMemo/src/com/example/android/apis/graphics/FingerPaint.java:22 
8 [error] The constructor ColorPickerDialog(FingerPaint, FingerPaint, int) is undefined 
[ant:iajc] new ColorPickerDialog(this, this, mPaint.getColor()).show(); 
[ant:iajc] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
[ant:iajc] /home/liberty/mp/android/AnyMemo/src/com/example/android/apis/graphics/FingerPaint.java:25 
4 [error] The method onOptionsItemSelected(MenuItem) is undefined for the type GraphicsActivity 
[ant:iajc] return super.onOptionsItemSelected(item); 
[ant:iajc]    ^^^^^^^^^^^^ 
[ant:iajc] /home/liberty/mp/android/AnyMemo/src/com/example/android/apis/graphics/FingerPaint.java:25 
8 [error] The method getDefaultSharedPreferences(Context) in the type PreferenceManager is not applic 
able for the arguments (FingerPaint) 
[ant:iajc] SharedPreferences shre = PreferenceManager.getDefaultSharedPreferences(this); 
[ant:iajc]    

EDIT: này file build.gradle thức mà làm việc cho dự án của tôi: https://code.google.com/p/anymemo/source/browse/build.gradle?spec=svnf85aaa4b2d78c62876d0e1f6c3e28252bf03f820&r=f85aaa4b2d78c62876d0e1f6c3e28252bf03f820

+0

Vì lỗi mới của bạn, tôi đã thử tạo lại bằng cách thêm thư viện jar, nhưng nó hoạt động tốt cho tôi. – aegar

+0

Tôi đoán lỗi không liên quan đến chính thư viện, vì iajc dường như tìm GraphicsActivity của bạn, nhưng nó có thể là đường dẫn sdk sai: tất cả các lỗi của bạn có liên quan đến các phương thức từ hoạt động không thể tìm thấy trong GraphicsActivity hoặc GraphicsActivity không được công nhận là một hoạt động trong các nhà xây dựng. Bạn đã kiểm tra biến androidSdk chưa? Tôi đang chỉ đến một nơi nào đó trong "/ home/aegar/android-sdk/platforms" nơi tôi chỉ có android-18. – aegar

+0

Đây là vấn đề phụ thuộc AAR. AAR không thể được sử dụng làm bình. Bạn đã xử lý dependencyProject nhưng, nếu bạn chỉ định biên dịch 'com.android.support:appcompat-v7:18.0.0', thì classes.jar nằm trong gói được giải mã, tất cả các jars trong thư mục này cần phải được thêm vào đường dẫn lớp. – Liberty

Trả lời

6

Tôi đã tìm ra rằng AAR không thể được sử dụng làm thư viện jar trong mã của tôi. Nếu bạn đang sử dụng các phụ thuộc như thế này

compile 'com.android.support:appcompat-v7:18.0.0' 

Bạn cần phải tìm tệp jar và thêm vào đường dẫn lớp. Các mã sau đây sẽ làm điều đó.

tree = fileTree(dir: "${project.buildDir}/exploded-bundles", include: '**/classes.jar') 
tree.each { jarFile -> 
    iajcClasspath += ":" + jarFile 
} 

Vì vậy, toàn bộ phần sẽ là:

variant.javaCompile.doLast { 
    // Find the android.jar and add to iajc classpath 
    def androidSdk = android.adbExe.parent + "/../platforms/" + android.compileSdkVersion + "/android.jar" 
    println 'Android SDK android.jar path: ' + androidSdk 

    def iajcClasspath = androidSdk + ":" + configurations.compile.asPath 
    configurations.compile.dependencies.each { dep -> 
     if(dep.hasProperty("dependencyProject")) { 
      iajcClasspath += ":" + dep.dependencyProject.buildDir + "/bundles/release/classes.jar" 
     } 
    } 

    // handle aar dependencies pulled in by gradle (Android support library and etc) 
    tree = fileTree(dir: "${project.buildDir}/exploded-bundles", include: '**/classes.jar') 
    tree.each { jarFile -> 
     iajcClasspath += ":" + jarFile 
    } 
     println 'Classpath for iajc: ' + iajcClasspath 

     ant.taskdef(resource:"org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.ajc.asPath) 

Đối với ví dụ đầy đủ xin vui lòng xem build.gradle cho dự án AnyMemo đây: https://code.google.com/p/anymemo/source/browse/build.gradle?spec=svnf85aaa4b2d78c62876d0e1f6c3e28252bf03f820&r=f85aaa4b2d78c62876d0e1f6c3e28252bf03f820

+0

Lưu ý: Sử dụng công cụ 19 Tôi nghĩ rằng chúng có thể đã thay đổi vị trí. Tôi cần sử dụng 'exploded-aar' thay vì 'exploded-bundles' từ ví dụ trên. – withoutclass

+0

không có lớp, Có họ đã đổi tên. https://code.google.com/p/anymemo/source/browse/build.gradle?spec=svnf85aaa4b2d78c62876d0e1f6c3e28252bf03f820&r=f85aaa4b2d78c62876d0e1f6c3e28252bf03f820 có thay đổi. – Liberty

+0

CẢM ƠN BẠN! Tôi đã bỏ lỡ bài đăng này và đấu tranh với câu trả lời aegar trước khi tôi từ bỏ và nhìn vào đây. Câu trả lời này cần nhiều upvotes hơn. – dieend

15

Tôi cũng muốn sử dụng AspectJ với gradle và Android Studio, và tôi cuối cùng làm cho nó hoạt động, nhưng tôi vẫn có một số đường dẫn viết tay mà tôi muốn thay thế bằng các tùy chọn gradle chung chung hơn.

Chỉnh sửa: Tôi thay thế mọi đường dẫn tuyệt đối được mã hóa cứng bằng các lựa chọn thay thế dựa trên gradle, vì vậy giải pháp này không còn phụ thuộc vào nền tảng hoặc tên người dùng nhất định. Tuy nhiên, nó vẫn sử dụng các đường dẫn tương đối có thể thay đổi từ một IDE sang một IDE khác hoặc trong các phiên bản tiếp theo của Android Studio. Ngoài ra, tôi không thực sự hài lòng với cách tôi tìm thấy android.jar.

tôi lần đầu tiên AspectJ tải:

configurations { 
ajc 
aspects 
ajInpath 
} 

ext.aspectjVersion = '1.7.3' 

dependencies { 
    compile project(":LibTest") 

    ajc "org.aspectj:aspectjtools:${aspectjVersion}" 
    compile "org.aspectj:aspectjrt:${aspectjVersion}" 
    compile 'com.android.support:appcompat-v7:18.0.0' 
} 

Và sau đó tôi thêm một nhiệm vụ mà sẽ chạy sau khi nhiệm vụ JavaCompile của biến thể hiện:

android.applicationVariants.all { variant -> 

    variant.javaCompile.doLast { 
     def androidSdk = android.adbExe.parent + "/../platforms/" + android.compileSdkVersion + "/android.jar" 

     def iajcClasspath = configurations.compile.asPath + ";" + androidSdk 
     configurations.compile.dependencies.each { dep -> 
      if(dep.hasProperty("dependencyProject")) { 
       iajcClasspath += ":" + dep.dependencyProject.buildDir + "/bundles/release/classes.jar" 
      } 
     } 

     ant.taskdef(resource:"org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.ajc.asPath) 
     ant.iajc (
       source:sourceCompatibility, 
       target:targetCompatibility, 
       destDir:"${project.buildDir}/classes/${variant.dirName}", 
       maxmem:"512m", 
       fork:"true", 
       aspectPath:configurations.aspects.asPath, 
       inpath:configurations.ajInpath.asPath, 
       sourceRootCopyFilter:"**/.svn/*,**/*.java", 
       classpath:iajcClasspath 
     ){ 
      sourceroots{ 
       android.sourceSets.main.java.srcDirs.each{ 
        pathelement(location:it.absolutePath) 
       } 
       pathelement(location:"${project.buildDir}/source/r/${variant.dirName}") 
      } 
     } 
    } 
} 

Bất cứ nơi nào tôi sử dụng ${variant.dirName}, nó sẽ được thay thế bằng cách "gỡ lỗi" hoặc "giải phóng" theo cấu hình bản dựng hiện tại.

Thêm android.jar vào đường dẫn lớp là bắt buộc để biên dịch các lớp cụ thể của Android và dòng pathelement(location:"${project.buildDir}/source/r/${variant.dirName}") được yêu cầu sử dụng các lớp từ tệp R.java được tạo tự động.

Chỉnh sửa: Các lần lặp lại phụ thuộc dự án để xây dựng iajcClasspath cho phép bạn sử dụng các lớp từ dự án thư viện của mình. configurations.compile.asPath đã chứa tham chiếu tới tệp apklib của bạn (tệp aar), đây thực sự là một tệp zip chứa cả bình và tài nguyên của thư viện. Iajc không nhận ra các tệp này vì nó, nhưng có một thư mục bó chứa các classes.jar cho thư viện của bạn trong thư mục build. Tôi sử dụng một đường dẫn tương đối với "phát hành" mã hóa cứng trong nó, bởi vì thư viện có một biến thể khác với dự án chính trong tình huống của tôi, vì vậy tôi không thể sử dụng ${variant.dirName} tại đây.

Đây là bản dựng hoàn chỉnh.tệp gradle:

buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:0.5.+' 
    } 
} 
apply plugin: 'android' 

repositories { 
    mavenCentral() 
} 

android { 
    compileSdkVersion 18 
    buildToolsVersion "18.1.0" 

    defaultConfig { 
     minSdkVersion 7 
     targetSdkVersion 18 
    } 
} 

configurations { 
    ajc 
    aspects 
    ajInpath 
} 

ext.aspectjVersion = '1.7.3' 

dependencies { 
    compile project(":LibTest") 

    ajc "org.aspectj:aspectjtools:${aspectjVersion}" 
    compile "org.aspectj:aspectjrt:${aspectjVersion}" 
    compile 'com.android.support:appcompat-v7:18.0.0' 
} 

android.applicationVariants.all { variant -> 

    variant.javaCompile.doLast { 
     def androidSdk = android.adbExe.parent + "/../platforms/" + android.compileSdkVersion + "/android.jar" 

     def iajcClasspath = configurations.compile.asPath + ";" + androidSdk 
     configurations.compile.dependencies.each { dep -> 
      if(dep.hasProperty("dependencyProject")) { 
       iajcClasspath += ":" + dep.dependencyProject.buildDir + "/bundles/release/classes.jar" 
      } 
     } 

     ant.taskdef(resource:"org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.ajc.asPath) 
     ant.iajc (
       source:sourceCompatibility, 
       target:targetCompatibility, 
       destDir:"${project.buildDir}/classes/${variant.dirName}", 
       maxmem:"512m", 
       fork:"true", 
       aspectPath:configurations.aspects.asPath, 
       inpath:configurations.ajInpath.asPath, 
       sourceRootCopyFilter:"**/.svn/*,**/*.java", 
       classpath:iajcClasspath 
     ){ 
      sourceroots{ 
       android.sourceSets.main.java.srcDirs.each{ 
        pathelement(location:it.absolutePath) 
       } 
       pathelement(location:"${project.buildDir}/source/r/${variant.dirName}") 
      } 
     } 
    } 
} 
+0

Cảm ơn bạn! Vấn đề duy nhất của tôi bây giờ là aspectj không tìm thấy các lớp học từ một dự án thư viện, bất kỳ ý tưởng về cách sửa lỗi này? – withoutclass

+2

Tôi có cùng một vấn đề liên quan đến việc sử dụng các thư viện, tôi nghĩ rằng nó sẽ là đủ để thêm dự án thư viện để classpath iajc, nhưng có vẻ như đó là đã có trong nó: 'println configure.compile.asPath' cho thấy một con đường bắt đầu với '/ home/aegar/AndroidStudioProjects/AopProject/LibTest/build/libs/LibTest.aar' trong trường hợp của tôi, vì vậy tôi nghĩ rằng vấn đề là iajc không nhận ra các thư viện aar như nó. – aegar

+2

@withoutclass: iajc bây giờ nhận ra thư viện của tôi, tôi đã cập nhật câu trả lời. Tôi hy vọng nó sẽ làm việc cho bạn quá. – aegar

4

Mặc dù câu trả lời trước các kịch bản làm việc cho hầu hết các tình huống, chúng không bao gồm một số vấn đề khi sử dụng Android với AspectJ và Gradle.

Thử nghiệm của tôi là tạo một dự án thư viện mà mọi người thông qua mavenCentral hoặc bởi tôi như một dự án thư viện tham chiếu và dự án ứng dụng thử nghiệm. Dự án thư viện là dự án có tất cả các khía cạnh và thử nghiệm ứng dụng đang cố gắng sử dụng các khía cạnh đó. Giving này như một bối cảnh, kết quả cấu trúc dự án là:

HEAD-Gradle 
---LibraryProject 
-------SomeAspects 
---TestApplication 
-------Uses-SomeAspects 

Các giải pháp tôi thấy rằng làm cho nó làm việc là:

1- Đối với dự án thư viện bạn phải sử dụng

libraryVariants.all { variant -> 

thay của

android.applicationVariants.all { variant -> 

2- dir xây dựng thay đổi cho 19. + công cụ xây dựng s của Android, do đó, vì nó được đề xuất trong một bình luận (nhờ "WithoutClass"), bạn phải sử dụng thư mục exploded-aar thay vì exploded-bundles dir trong định nghĩa biến cây. Từ:

def tree = fileTree(dir: "${project.buildDir}/exploded-bundles", include: '**/classes.jar') 

Để:

def tree = fileTree(dir: "${project.buildDir}/exploded-aar", include: '**/classes.jar') 

3- Vấn đề cuối cùng tôi phải đối mặt khi thực hiện việc lồng ghép là nếu bạn có một dự án thư viện, các khía cạnh xác định trên nó không được tìm thấy trên các dự án con . Để giải quyết điều này, bạn phải thêm classes.jar của thư viện tùy chỉnh của bạn vào cấu hình trình biên dịch aspectJ. Bạn có thể đạt được điều này bằng cách thêm vào các phụ thuộc:

aspects project(":YourLibraryProject") 

và cũng cần thực hiện một số thay đổi trong tập lệnh được cung cấp trong bài đăng cuối cùng này.

Ngay bây giờ kịch bản tốt nhất mà tôi có thể tưởng tượng rằng cho hỗ trợ đầy đủ cho AspectJ sử dụng thậm chí dự án thư viện là:

Đối với phụ thuộc:

configurations { 
    ajc 
    aspects 
    ajInpath 
} 

//Version of aspectj 
def aspectjVersion = '1.8.+' 
// The dependencies for this project 
dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    //Your dependencies to a custom library project 
    compile project(":YourLibraryProject") 
    aspects project(":YourLibraryProject") 
    //Aspectj dependencies 
    ajc "org.aspectj:aspectjtools:${aspectjVersion}" 
    compile "org.aspectj:aspectjrt:${aspectjVersion}" 
} 

Trình biên dịch chạy script

android.applicationVariants.all { variant -> 

variant.javaCompile.doLast { 
    // Find the android.jar and add to iajc classpath 
    def androidSdk = android.adbExe.parent + "/../platforms/" + android.compileSdkVersion + "/android.jar" 

    def iajcClasspath = androidSdk + ":" + configurations.compile.asPath 
    //This line and the fordward assignations allow the aspects support in the child project from the library project 
    def customAspectsPath = configurations.aspects.asPath 
    configurations.compile.dependencies.each { dep -> 
     if(dep.hasProperty("dependencyProject")) { 
      iajcClasspath += ":" + dep.dependencyProject.buildDir + "/bundles/${variant.buildType.name}/classes.jar" 
      customAspectsPath += ":" + dep.dependencyProject.buildDir + "/bundles/${variant.buildType.name}/classes.jar" 
     } 
    } 

    // handle aar dependencies pulled in by gradle (Android support library and etc) 

    def tree = fileTree(dir: "${project.buildDir}/exploded-aar", include: '**/classes.jar') 
    tree.each { jarFile -> 
     iajcClasspath += ":" + jarFile 
    } 

    ant.taskdef(resource:"org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.ajc.asPath) 
    ant.iajc (
      source:sourceCompatibility, 
      target:targetCompatibility, 
      destDir:"${project.buildDir}/classes/${variant.dirName}", 
      maxmem:"512m", 
      fork:"true", 
      aspectPath:customAspectsPath, 
      inpath:configurations.ajInpath.asPath, 
      sourceRootCopyFilter:"**/.svn/*,**/*.java", 
      classpath:iajcClasspath 
    ){ 
     sourceroots{ 
      android.sourceSets.main.java.srcDirs.each{ 
       pathelement(location:it.absolutePath) 
      } 
      pathelement(location:"${project.buildDir}/source/r/${variant.dirName}") 
     } 
    } 
} 
} 

Ghi nếu bạn muốn chạy AspectJ trên một dự án thư viện-con, bạn cũng phải có tập lệnh này trên build.gradle của thư viện.

1

Trong trường hợp sử dụng Android Studio 0.8 trở lên, có vẻ như việc sử dụng gradet 0.12. + Là cần thiết.

Trong gradle 0,12. +, Aar được giải mã được trích xuất trong thư mục xây dựng, chứ không phải trong thư mục exploded-aar.

Vì vậy, để xử lý phụ thuộc aar, bạn phải sử dụng mã này:

tree = fileTree(dir: "${project.buildDir}", include: '**/classes.jar') 
tree.each { jarFile -> 
    iajcClasspath += ":" + jarFile 
} 
Các vấn đề liên quan