fat-aar-android icon indicating copy to clipboard operation
fat-aar-android copied to clipboard

Support AGP 8.0+

Open aasitnikov opened this issue 1 year ago • 25 comments

This pull request adds support for AGP 8.0.

Note that this branch includes fix from #403.

To get this version into your project, you can use jitpack as follows:

allprojects {
    repositories {
        ...
        maven {
            setUrl("https://jitpack.io")
            content { includeGroup("com.github.aasitnikov") }
        }
    }
}

dependencies {
    implementation("com.github.aasitnikov:fat-aar-android:b2a038763c")
}

aasitnikov avatar Jun 02 '23 11:06 aasitnikov

@aasitnikov I have an error: Cause: {module_name} module's AndroidManifest not found. But this module has AndroidManifest file and it was working before Gradle 8, what can be wrong?

KindiiV avatar Jun 07 '23 08:06 KindiiV

same for me the first lib i do embed will end in this error Caused by: org.gradle.api.internal.tasks.properties.PropertyEvaluationException: Error while evaluating property 'visitorsList.$0.parameters.libraryNamespaces' of task ':app:transformDebugClassesWithAsm'. Caused by: org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to calculate the value of property 'libraryNamespaces'.

TVDiasDominik avatar Jun 14 '23 09:06 TVDiasDominik

@aasitnikov Hello, there are problems (AGP: 8.0.2, Gradle: 8.1.1)

Configuration 'embed' was resolved during configuration time. This is a build performance and scalability issue. See https://github.com/gradle/gradle/issues/2298 Run with --info for a stacktrace. java.lang.RuntimeException: Configuration 'embed' was resolved during configuration time. This is a build performance and scalability issue. See https://github.com/gradle/gradle/issues/2298 at com.android.build.gradle.internal.DependencyResolutionChecks$registerDependencyCheck$4$1.execute(DependencyResolutionChecks.kt:72)

Task :sdk:transformDebugClassesWithAsm FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':sdk:transformDebugClassesWithAsm'.

Error while evaluating property 'visitorsList.$0.parameters.libraryNamespaces' of task ':sdk:transformDebugClassesWithAsm'. Failed to calculate the value of property 'libraryNamespaces'. > test module's AndroidManifest not found

AGP: 7.2.0, Gradle: 7.6: Works without errors

ralikhachev avatar Jun 19 '23 07:06 ralikhachev

Hi @aasitnikov,

i tried to update my fork with your changes but unfortunately i do get the same error that others reported as soon as i use AGP 8.0.0 or higher.

After a first look it looks like you are trying to access the AndroidManifest of the exploded aar before you explode the aar.

Maybe you have an idea how to resolve this error.

Best regards, Andi

AndreasBoehm avatar Jun 20 '23 06:06 AndreasBoehm

I figured out potential issue, try "com.github.aasitnikov:fat-aar-android:b2a038763c" to see if it works for you

aasitnikov avatar Aug 23 '23 17:08 aasitnikov

Merged into an off-site repo, builds are successful. Thank you for bothering to fix what Google won't even develop.

thisisatestuseraccount avatar Sep 04 '23 16:09 thisisatestuseraccount

Thanks a lot @aasitnikov !

I used AGP 8.1.1 and gradle 8.3 and it's working fine now.

AndreasBoehm avatar Sep 05 '23 13:09 AndreasBoehm

Thanks for the fix! Successfully used in gradle 8.3 :D

RedRackham-R avatar Sep 06 '23 09:09 RedRackham-R

If you struggle with connecting this fix via Kotlin DSL use this approach: Add these closures to the settings.gradle

pluginManagement {
    repositories {
        maven {
            setUrl("https://jitpack.io")
            content { includeGroup("com.github.aasitnikov") }
        }
    }
}

In the root build.gradle.kts you have to use the old buildScript approach because I haven't figured out how to find plugin ID to add it to the plugins block.

buildscript {
    dependencies {
        classpath("com.github.aasitnikov:fat-aar-android:ce932b38ef")
    }
}

Finally, add the plugin in build.gradle.kts of your module.

plugins {
    ....
    id("com.kezong.fat-aar")
}

flasher297 avatar Sep 14 '23 20:09 flasher297

If you struggle with connecting this fix via Kotlin DSL use this approach: Add these closures to the settings.gradle

pluginManagement {
    repositories {
        maven {
            setUrl("https://jitpack.io")
            content { includeGroup("com.github.aasitnikov") }
        }
    }
}

In the root build.gradle.kts you have to use the old buildScript approach because I haven't figured out how to find plugin ID to add it to the plugins block.

buildscript {
    dependencies {
        classpath("com.github.aasitnikov:fat-aar-android:ce932b38ef")
    }
}

Finally, add the plugin in build.gradle.kts of your module.

plugins {
    ....
    id("com.kezong.fat-aar")
}

@flasher297 Hey guy, I just did as you say, it still threw error in Android Studio as below: image

dh336699 avatar Sep 26 '23 08:09 dh336699

Hi @aasitnikov. Try you patch on my project. Versions: agp 8.1, gradle 8.3.

Looks like result lib.aar missing jar file with R classes. Application with aar like this fails. In attached screenshot you can see example of R classes jar file that missing in patched fat-aar output. What can be wrong? aar_tree

bugDim88 avatar Oct 20 '23 08:10 bugDim88

Thank you @aasitnikov it's working.

HamzaOban avatar Nov 14 '23 06:11 HamzaOban

Works for me!

: gradle 8.0

And here is my changed files:

root settings.gradle

pluginManagement {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
        ...
    }
}

root build.gradle

buildscript{
    dependencies {
        // classpath 'com.github.kezong:fat-aar:1.3.8'
        classpath("com.github.aasitnikov:fat-aar-android:b2a038763c")
    }
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    ...
}

the sdk need embed. build.gradle

plugins {
    ...
    id 'com.kezong.fat-aar'
}

dyguests avatar Dec 12 '23 09:12 dyguests

@dyguests 老哥,我的依然没成功,能留个联系方式交流交流吗

gaoruiqing187 avatar Dec 22 '23 01:12 gaoruiqing187

@dyguests 老哥,我的依然没成功,能留个联系方式交流交流吗

我上面的回复,已经是我全部修改内容啦 ,没别的办法啦。

dyguests avatar Dec 23 '23 08:12 dyguests

@aasitnikov today i tried updating to gradle 8.6 and it does not work anymore. Can you maybe also fix it for 8.6?

TVDiasDominik avatar Feb 05 '24 10:02 TVDiasDominik

@TVDiasDominik you can try my fork https://github.com/lsuski/fat-aar-android/tree/support_gradle86

lsuski avatar Feb 19 '24 11:02 lsuski

Support AGP 8.3.1 ?

MichaelNien avatar Apr 02 '24 10:04 MichaelNien

Try out https://github.com/aasitnikov/fat-aar-android with AGP 8.3.0 support

aasitnikov avatar Apr 04 '24 15:04 aasitnikov

@dyguests 老哥,我的依然没成功,能留个联系方式交流交流吗

我上面的回复,已经是我全部修改内容啦 ,没别的办法啦。

Works for me!

: gradle 8.0

And here is my changed files:

root settings.gradle

pluginManagement {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
        ...
    }
}

root build.gradle

buildscript{
    dependencies {
        // classpath 'com.github.kezong:fat-aar:1.3.8'
        classpath("com.github.aasitnikov:fat-aar-android:b2a038763c")
    }
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    ...
}

the sdk need embed. build.gradle

plugins {
    ...
    id 'com.kezong.fat-aar'
}

dependencies依赖的还是用embed project吗?

jike1502jt avatar Apr 28 '24 08:04 jike1502jt

This pull request adds support for AGP 8.0.

Note that this branch includes fix from #403.

To get this version into your project, you can use jitpack as follows:

allprojects {
    repositories {
        ...
        maven {
            setUrl("https://jitpack.io")
            content { includeGroup("com.github.aasitnikov") }
        }
    }
}

dependencies {
    implementation("com.github.aasitnikov:fat-aar-android:b2a038763c")
}

image 我用了报这个是什么问题,我gradle版本是8.01

jike1502jt avatar Apr 29 '24 06:04 jike1502jt

@jike1502jt 我真不知道了。 而且这个方案我们已经废弃了,新方案都没用 fat-aar 了。 现在我都没做这个项目了。

dyguests avatar Apr 29 '24 06:04 dyguests

@jike1502jt 我真的不知道了。 而且这个方案我们已经荒废了,新方案都已经用 fat-aar 了。 现在我已经不再做这个项目了。

fat-aar 不是不支持gradle8以上吗?

jike1502jt avatar Apr 29 '24 06:04 jike1502jt

Try out https://github.com/aasitnikov/fat-aar-android with AGP 8.3.0 support

Support AGP 8.5.x ?

MichaelNien avatar Jun 19 '24 13:06 MichaelNien

Try out latest release with AGP 8.5 support at https://github.com/aasitnikov/fat-aar-android

aasitnikov avatar Jun 24 '24 15:06 aasitnikov