uPhyca / gradle-android-aspectj-plugin

A Gradle plugin which enables AspectJ for Android builds.
Apache License 2.0
279 stars 55 forks source link

VerifyErrors #2

Closed cz4rny closed 9 years ago

cz4rny commented 10 years ago

I've seen from the commits that this has been fixed once a few days ago. With g-a-a-p 0.9.5 I'm getting the VerifyError when running weaved code (I see in the logs that the files are weaved).

My set up is a library project with jcabi-aspects that is weaved and then an APK project linking with the library.

apply plugin: 'android-library'
apply plugin: 'android-aspectj'

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.github.dcendents:android-maven-plugin:1.0'
        classpath 'com.uphyca.gradle:gradle-android-aspectj-plugin:0.9.+'
    }
}

android {
    compileSdkVersion 19
    buildToolsVersion '19.1'
    defaultConfig {
        minSdkVersion 10
    }
}

repositories {
    maven { url 'http://www.bugsense.com/gradle/' }
}

dependencies {
    compile 'com.google.android.gms:play-services:+'
    compile 'com.android.support:appcompat-v7:19.+'
    compile 'com.jcabi:jcabi-aspects:0.16'
}

And then the APK project:

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

repositories {
    maven { url 'http://www.bugsense.com/gradle/' }
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.1"

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 19
    }

}

dependencies {
    compile ('com.sprezzat:thread_sdk:+@aar'){
        transitive=true
    }
}

And the stacktrace:

06-24 23:20:45.882  25021-25080/com.sprazzet.threadhelloworld E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #5
    Process: com.sprazzet.threadhelloworld, PID: 25021
    java.lang.RuntimeException: An error occured while executing doInBackground()
            at android.os.AsyncTask$3.done(AsyncTask.java:300)
            at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
            at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
            at java.util.concurrent.FutureTask.run(FutureTask.java:242)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:864)
     Caused by: java.lang.VerifyError: com/jcabi/aspects/aj/Repeater
            at com.sprezzat.threadapi.HttpDownloadTask.postDownloadRequest(HttpDownloadTask.java:364)
            at com.sprezzat.threadapi.HttpDownloadTask$HttpDownloadAsyncTask.doInBackground(HttpDownloadTask.java:117)
            at com.sprezzat.threadapi.HttpDownloadTask$HttpDownloadAsyncTask.doInBackground(HttpDownloadTask.java:91)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:864)
esmasui commented 10 years ago

Does your project works on previous android-aspctj plugin without verify errors?

cz4rny commented 10 years ago

That’s a valid question. I’ll check that and report back. Have to lower the android gradle tools version to make that.

On Wednesday, 25 June 2014 at 11:13, Sosuke Masui wrote:

Does your project works on previous android-aspctj plugin without verify errors?

— Reply to this email directly or view it on GitHub (https://github.com/uPhyca/gradle-android-aspectj-plugin/issues/2#issuecomment-47077705).

cz4rny commented 10 years ago

@esmasui Tested with:

    classpath 'com.android.tools.build:gradle:0.9.+'
    classpath 'com.uphyca.gradle:gradle-android-aspectj-plugin:0.9.4+'

And no VFY errors visible.

Please note, that I have never perviously used 0.9.4. I've started with 0.9.5 and reported the issue, so I've downgraded to test as per your request.

esmasui commented 10 years ago

@cz4rny Thank you for your report. I will fix the errors in next release. Please use 0.9.4 until new version is released.

georgepapas commented 10 years ago

Any updates on this? I too get the same error, but when I downgrade to 0.9.4 I have an incompatibility with this plugin and the android plugin we are using on our project. specifically

No such property: runtimeJarList for class: com.android.build.gradle.AppPlugin

If i monkey patch my AppPlugin class to expose a runtimeJarList property which simply delegates to the bootclasspath, I get other issues related to hardcoded source roots in 0.9.4 version of plugin which do not exist.

esmasui commented 10 years ago

@cz4rny @georgepapas I've just released new version 0.9.7 that fixes VFY errors and supports latest Android build tools. Please try it.