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

failed to compile by using AS 4.1.0 #300

Open
samlu opened this issue Oct 16, 2020 · 3 comments
Open

failed to compile by using AS 4.1.0 #300

samlu opened this issue Oct 16, 2020 · 3 comments

Comments

@samlu
Copy link

samlu commented Oct 16, 2020

Android Studio 4.1.0 no more supports BuildConfig.VERSION_NAME for library projects.
See https://developer.android.com/studio/releases/gradle-plugin#behavior_changes for details.

It results in the related code won't pass the compilation. Here listed are some examples.

@Override
public VersionInfo getVersionInfo() {
String versionString = BuildConfig.VERSION_NAME;

AudienceNetworkAds.buildInitSettings(context)
.withMediationService("GOOGLE:" + BuildConfig.VERSION_NAME)

Other mediation SDKs have the same issue.

@ericleich
Copy link
Member

@samlu we discovered the same yesterday and are working on a solution for it by defining a custom build config parameter.

That said, are you having an issue including the already compiled Facebook adapter as recommended here, or are you trying to build the Facebook adapter yourself? I'd only suspect you'd have the problem if you're trying to build yourself.

@samlu
Copy link
Author

samlu commented Oct 16, 2020

Looking forward to seeing the new solution.

Yes, I am building the FAN adapter myself.

@ericleich
Copy link
Member

@samlu So we haven't added this to Facebook yet as we haven't had to make a change on their adapter yet or do a release, but to unblock you, 908719f is an example of the approach we're taking on other adapters.

The BuildConfig generated by AS 4.1.0 doesn't have VERSION_NAME or VERSION_CODE anymore. We opted to define our own custom variable ADAPTER_VERSION instead, and use that in the code. By using a different custom field name as opposed to VERSION_NAME, it's compatible with older android studio versions (which would otherwise generate that field twice and fail to compile).

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