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

Publish aar correctly #696

Closed
Sloy opened this issue Aug 18, 2020 · 7 comments
Closed

Publish aar correctly #696

Sloy opened this issue Aug 18, 2020 · 7 comments

Comments

@Sloy
Copy link
Contributor

Sloy commented Aug 18, 2020

We updated our Segment dependency to the 4.8.0 version, which includes the fix for #668. However, it's not working. We just realized that the Segment dependency imports the jar file (java only) instead of the aar file (java + android) which includes the Proguard configuration.

Apparently there's some issue with the maven publication, and it's not generating the pom.xml file correctly. It's missing the <packaging>aar</packaging> declaration.
For comparison, here is the Segment SDK pom.xml, and here is another one with the proper configuration.

We believe this could be fixed by updating the publishing Gradle configuration. Right now Segment is using the old deprecated maven plugin. (See https://github.com/segmentio/analytics-android/blob/master/gradle/gradle-mvn-push.gradle#L17). The Android Gradle Plugin now officially supports the new maven-publish plugin. More info in https://developer.android.com/studio/build/maven-publish-plugin

As a workaround, we tried to import the SDK dependency as implementation("com.segment.analytics.android:analytics:4.8.2@aar"), but this causes errors with other transitive dependencies, as Gradle thinks it's a completely different dependency. So right now we're back to adding the Proguard configuration in our own project.

@prayansh
Copy link
Contributor

prayansh commented Aug 18, 2020

Hey @Sloy! Thanks for the info. I'm trying to assess the path forward, so I want to gather some more details.

So right now we're back to adding the Proguard configuration in our own project.

Reading this, makes me think that you are not currently blocked. Is that right? Additionally, any reason why you think including the Proguard config in your own project is not an ideal solution?

@Sloy
Copy link
Contributor Author

Sloy commented Aug 18, 2020

That's correct, we are not currently blocked by this.

I don't think manually maintaining the Proguard config from third-party libraries in our projects is an ideal solution, is a solution.

If we didn't have a mechanism for importing Proguard configurations from libraries, as it happened some years ago, that would be the only solution for sure. We would copy the Proguard configuration from the library readme, and make sure to check for any changes every time a new version is released, so we can manually update the configuration. Or have people excluding everything in their app (as I've seen many times) because they don't have the time to deal with Proguard errors.

Now that we have an automated mechanism, I think it's on the best interest of everyone that the libraries takes care of the Proguard config, so consumers don't need to deal with the issues above. Just like we have transitive dependencies with maven/gradle so consumers don't need to maintain the dependencies from each library. I remember Android development before Gradle, and it wasn't pretty 😂.

If the aar was working, the fix in #668 would be available to everyone using this library. But instead, all of your clients must remember to manually configure Proguard. I'm sure you have a lot of clients. And I can tell you at Adevinta we have 4 projects using this library, and none of us remembered to include the Proguard configuration 😅.

Sorry, I got a bit philosophical there! I hope that was the answer you were looking for.

@prayansh
Copy link
Contributor

Yup thats exactly what i was looking for. TYSM for the detailed explanation :). I don't want to make any promises about the timeline, since we are currently busy with other features/priorities and will have to punt this issue to sometime later. I have created an internal JIRA ticket so that it gets prioritized accordingly.
I will make sure to tag you when a fix is ready :)

@Sloy
Copy link
Contributor Author

Sloy commented Aug 18, 2020

Thank you @prayansh

@prayansh
Copy link
Contributor

@Sloy i recently did some rework on our publication process, fixing the pom property issue. The newest version 4.9.1-beta is available if you want to try it out :)

@Sloy
Copy link
Contributor Author

Sloy commented Nov 25, 2020

Hello @prayansh! Thank you a lot for getting back to me. The file list in Maven Repository looks promising :)
I'll give it a try tomorrow and make sure the Proguard issue is finally solved with this change

@Sloy
Copy link
Contributor Author

Sloy commented Nov 26, 2020

I couldn't break the release flavour of our app using this beta, so that's good! I expect it will work for all users in production when we publish a version with the updated SDK 😃

Again, thanks for taking care of this! ❤️

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

No branches or pull requests

2 participants