Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AGP 8.0 #411

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Support AGP 8.0 #411

wants to merge 6 commits into from

Conversation

aasitnikov
Copy link

@aasitnikov aasitnikov commented Jun 2, 2023

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")
}

@KindiiV
Copy link

KindiiV commented Jun 7, 2023

@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?

@TVDiasDominik
Copy link

TVDiasDominik commented Jun 14, 2023

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'.

@ralikhachev
Copy link

ralikhachev commented Jun 19, 2023

@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 gradle/gradle#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 gradle/gradle#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

@AndreasBoehm
Copy link

AndreasBoehm commented Jun 20, 2023

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

@aasitnikov
Copy link
Author

aasitnikov commented Aug 23, 2023

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

@thisisatestuseraccount
Copy link

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

@AndreasBoehm
Copy link

AndreasBoehm commented Sep 5, 2023

Thanks a lot @aasitnikov !

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

@RedRackham-R
Copy link

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

@flasher297
Copy link

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")
}

@dh336699
Copy link

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

@bugDim88
Copy link

bugDim88 commented Oct 20, 2023

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

@HamzaOban
Copy link

Thank you @aasitnikov it's working.

@dyguests
Copy link

dyguests commented Dec 12, 2023

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'
}

@gaoruiqing187
Copy link

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

@dyguests
Copy link

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

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

@TVDiasDominik
Copy link

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

@lsuski
Copy link

lsuski commented Feb 19, 2024

@MichaelNien
Copy link

Support AGP 8.3.1 ?

@aasitnikov
Copy link
Author

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

@jike1502jt
Copy link

@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
Copy link

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

@dyguests
Copy link

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

@jike1502jt
Copy link

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet