airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
199 stars 11 forks source link

Google Play is giving me 30 days for SDK and APP-Billing #3345

Open Menard1965 opened 1 month ago

Menard1965 commented 1 month ago

Hi I am using Adobe Animate and Harman SDK 50.2.5.1 and from Distriqt inapp ANE ###### 2024.05.16 [v15.4.0]

I have to use Google Billing 6.0.1 or higher. Further more i have to use target SDK 34

Please help Michael

marchbold commented 1 month ago

The latest InAppBilling extension support v6.2.1 of the play billing library. I'd suggest you check whether you have correctly added your manifest additions as you likely have missed some changes in there.

https://docs.airnativeextensions.com/docs/inappbilling/add-the-extension

mucoci commented 1 month ago

Hi, for the recently issue about SDK 34

  1. Google billing : Distriqt in-appbilling ANE...just update, it is already v6.2.1

  2. Google SDK 34: update to api 34 and build tool to 34 in Android studio

  3. SDK 34 will need Java 17, you can update it in Android Studio, too

  4. SDK 34 will also need gradle 8.0+,you can still update it in Android Studio

  5. change your project's description xml, find this and change it......android:targetSdkVersion="34"

  6. In my case, I build successly, but it sill tell me, the gradle version is 7.x. So I add this in description xml

<android>

   <gradleVersion>8.0</gradleVersion>
    <androidGradlePluginVersion>8.1.1</androidGradlePluginVersion>

then it build well~

Menard1965 commented 1 month ago

Hi I am using Adobe Animate I am building bundle directly from Animate

So please help me what i have to do. In harman.cfg ihave activated bundle and path to java.

How is the android part be right in descriptor file of my app. I dont know what cradle is.

Please help

ajwfrost commented 1 month ago

@Menard1965 presumably you also have Android Studio installed somewhere? If you open that up, and open the "SDK Manager" from its Tools menu, you can update the SDK to include Android 14 (in "SDK Platforms" tab: just the "Android SDK Platform 34", you don't need the Sources), and the build tools (in "SDK Tools" tab, 34.0.0 should be okay) and then apply those changes.

If you also have AIR SDK 51.0.1.4 installed, then that's about it. Otherwise, you may need to do the extra steps, per the above .. in your configuration file, ensure that the JAVA_HOME thing points to a JDK 17 version (you can find one in your Android Studio installation under a 'jbr' folder), and then in your application descriptor file, you can manually get it to use the appropriate Gradle versions by adding those gradleVersion and androidGradlePluginVersion fields per the above (in the <android> section).

Gradle is a mechanism for building things, which Android uses, and the Android-specific stuff happens via this "Android Gradle Plug-in". So, to use Android 34 properly, it requires you to use Android Gradle Plug-in 8.x.x. And to use this version of the plug-in, you need Java 17 and you need Gradle 8. Lots of dependencies! but hopefully with our latest AIR SDK release we had got most of this set up to automatically work out what was required!

Don't forget too, in your application descriptor <manifestAdditions>, you need to add the actual target SDK level: within the <manifest> tag, you'd need e.g.:

    <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34"/>
Menard1965 commented 1 month ago

THX I updated Android Studio und also JAVA. What I have now is that compiling the aab for Android I get Error messages JAVA Home is not defined. JavaHome what is v17+ ? please help

Menard1965 commented 1 month ago

New Status. What i achieved is the following. Android1

I am a little bit confused about the different Specifications and Versions:

My JAVA is version: 1.8.0_361 You are write Java 17 ???

You write JBR Folder under Android Studio but there is no Folder JBR And wht is JRE ??

Thx

ajwfrost commented 1 month ago

Hi

You can run the AIR tools (ADT) using Java 1.8, but the Android build tools need a later version, so we go looking for them.. if we can't find them, we ask you to specify that "JAVA_HOME" configuration variable so that we know where to look. ADT then launches the new Java process separately, so that we can stay with the 1.8 runtime for ADT whilst the Android-specific build runs on the later version.

And Android changed their requirements so that for their Android API level 34 (Android 14) you should use the Android Gradle Plugin version 8 or higher to compile the app - but this needs Java version 17 or higher in order to run it (i.e. 'v17+' = "version 17 or higher"). So, because you've got the latest Android settings, it's trying to run using the Android Gradle Plug-in 8.1.1 and therefore needs Java 17. Which is appears to have found, given your Animate pop-up is showing success with a couple of 'note' entries.

If you've got an up-to-date version of Android Studio, then if you go to the folder: C:\Program Files\Android\Android Studio you should see a subfolder "jbr". This contains the Java installation that Android Studio uses, I have no idea what 'jbr' means but that folder used to be called 'jre' in earlier versions of Android Studio (= java runtime environment).

Hope that helps. It looks like it's working from that screenshot though; Animate treats any output as if it's a warning, sadly, but these were meant to be just informational notes!

thanks

Menard1965 commented 1 month ago

Thx Andrew!

I have to get used to this new methods. I know that you are also forced by Google to do so :)

f you've got an up-to-date version of Android Studio, then if you go to the folder: C:\Program Files\Android\Android Studio

I have no JBR Folder there ?

Android-Studio

Menard1965 commented 1 month ago

oh i had to update Android Studio as well THX. There is the folder and i will also update Gradle Plugins

FliplineStudios commented 2 weeks ago

If you also have AIR SDK 51.0.1.4 installed, then that's about it. Otherwise, you may need to do the extra steps, per the above .. in your configuration file, ensure that the JAVA_HOME thing points to a JDK 17 version (you can find one in your Android Studio installation under a 'jbr' folder), and then in your application descriptor file, you can manually get it to use the appropriate Gradle versions by adding those gradleVersion and androidGradlePluginVersion fields per the above (in the <android> section).

Just curious if this solution of setting gradleVersion/androidGradlePluginVersion in the app xml is only supported on certain versions of the AIR SDK? I'm attempting to build for target 34 using 50.2.5.1 (with latest Android Studio 2024.1.1, build tools 34.0.0, JDK17 from jbr set in JAVA_HOME environment variable, setting targetSdkVersion 34 and gradleVersion 8.0 and androidGradlePluginVersion 8.1.1 in xml), but I get a Build Failed message with "Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl > Namespace not specified".

If I don't specify gradleVersion/androidGradlePluginVersion, 50.2.5.1 continues to use plugin 7.4.0 instead of 8.1.1 when targeting 34. (editing gradle-wrapper.properties for 8.0 in the AIR SDK doesn't seem to make a difference either)

I don't get any errors with AIR SDK 51.1.1.3 and it correctly uses 8.1.1 automatically, though I'm a bit hesitant to use a brand-new SDK for updating all of our live apps -- was hoping it was doable with 50.2.x which we've thoroughly tested instead of jumping to 51 quite yet, but maybe that's not feasible with all of the API 34 requirements...

FliplineStudios commented 2 weeks ago

Quick update: It's looking like I can't set gradleVersion and androidGradlePluginVersion with AIR SDK 50.2.x if I'm using certain extensions -- in my case, I'm getting that same build failure above when using distriqt ANEs like "Application ANE" and various dependencies like the play services ANEs, whether I set minSdkVersion to 21 or 24, whether I'm using older 2023 ANEs or the latest ones. If I remove the ANEs, it packages correctly with the gradle version I set. Does this option to set the gradleVersion in the <android> section not work well when using extensions in 50.2? (@marchbold wondering if you had any thoughts on that?)

If it ends up the best route is to just use AIR 51.1+ to target API Level 34 correctly, I'll plan to wait a while for updating all of our apps until things seem stable and we've had time to test all of our games with 51.1 first. (I've just done a quick test so far, but was at least able to package with 51.1.1.3 and the latest ANEs)

marchbold commented 2 weeks ago

@FliplineStudios Can you elaborate some more? Are you saying using an old sdk and attempting to modify the gradle version is failing with our extensions? Which exact version of AIR are you using?

FliplineStudios commented 2 weeks ago

@marchbold Sure, here's what I've been trying:

I've tried packaging with both AIR 50.2.4.4 and 50.2.5.1, with targetSdkVersion 34, and attempting to set this in the <android> section:

<gradleVersion>8.0</gradleVersion>
<androidGradlePluginVersion>8.1.1</androidGradlePluginVersion>

I keep getting that build failure with "Namespace not specified" mentioned above if I include the extensions, but if I leave out the extensions it will build correctly with the gradle version I set. This is with the newest Android Studio with Build Tools 34.0.0, and OpenJDK 17 (and double-checked in AIR SDK Manager that adt and gradle were both using that JDK).

I do want to mention that everything packages correctly with 50.2.x if I don't change the gradle values (though not sure if Google will flag targeting 34 while using the older AGP not recommended for it). And if I switch to 51.1.1.3 it also packages correctly (and by default is using the newer built-in gradle settings).

Some other things I've tried (which didn't help):

The app is using the Application ANE and InAppBilling ANE, along with the required ANEs to go along with them as usual.

FliplineStudios commented 1 week ago

For reference, here's the exact error I'm getting when running adt from 50.2.5.1 when trying to also set gradleVersion and androidGradlePluginVersion and targeting 34 when using ANEs:

NOTE: Multiple Android build-tools folders exist, choosing the latest version (34.0.0) for packaging
unexpected failure: Unable to run java: com.adobe.air.ADTException: gradle tool failed:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':androidx.activity'.
> Failed to notify project evaluation listener.
   > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
      > Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

        If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.
   > Could not get unknown property 'generateReleaseBuildConfig' for project ':androidx.activity' of type org.gradle.api.Project.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 8s

java.io.IOException: Unable to run java: com.adobe.air.ADTException: gradle tool failed:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':androidx.activity'.
> Failed to notify project evaluation listener.
   > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
      > Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

        If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.
   > Could not get unknown property 'generateReleaseBuildConfig' for project ':androidx.activity' of type org.gradle.api.Project.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 8s

        at com.adobe.air.apk.AABOutputStream.buildGradle(AABOutputStream.java)
        at com.adobe.air.apk.AABPackager.renameOutput(AABPackager.java)
        at com.adobe.air.ApplicationPackager.createPackage(ApplicationPackager.java)
        at com.adobe.air.apk.AABPackager.createPackage(AABPackager.java)
        at com.adobe.air.ADT.parseArgsAndGo(ADT.java)
        at com.adobe.air.ADT.run(ADT.java)
        at com.adobe.air.ADT.main(ADT.java)

and my app is using the InAppBilling ANE and Application ANE, these are the extensions the documentation had me add:

<extensions>
    <extensionID>com.distriqt.InAppBilling</extensionID>
    <extensionID>com.distriqt.Application</extensionID>
    <extensionID>com.distriqt.Core</extensionID>
    <extensionID>androidx.core</extensionID>
    <extensionID>com.distriqt.playservices.Base</extensionID>
        <extensionID>com.distriqt.playservices.AppSet</extensionID>
    <extensionID>com.google.android.play</extensionID>
        <extensionID>com.jetbrains.kotlin</extensionID>
</extensions>

(all using the latest downloads from last week)

Not sure if there's anything for me to adjust configuration-wise to get around this that I'm just missing. Since the app with ANEs packages correctly with 51.1, I'm wondering if I should just consider 50.2 no longer viable for API Level 34 and plan to just move over to 51.1 instead, and start spending my time playtesting with that newer release rather than trying to force 50.2 to package for 34. I'm always hesitant to go right to production with an AIR SDK release that just came out, but maybe there's not an easy way around it this time. Any thoughts would be appreciated!

ajwfrost commented 1 week ago

Ah: so > Namespace not specified. Specify a namespace in the module's build file

From what I can see, we added support for this for the generated 'app' in 50.2.3.1 so it should be in the version you have there, but it's possible this may be missing from one of the libraries / ANEs .. and actually, yes, this also says it's androidx.activity and fails in LibraryVariantBuilderImpl

Not sure where that particular project is being generated from though .. you may need to do a 'find' in the ANE files somehow to see whether one of them has a resource set up as androidx.activity?

One option to resolve this though .. if you build with the android-studio target - or just set KeepAndroidStudioOutput to true in your adt.cfg file - you can then open the resulting folder within Android Studio. Then look at the gradle files and find the one for androidx.activity, and manually add in the namespace line (e.g. namespace 'androidx.activity') at the start of the android { block of the project's build.gradle file.

thanks

FliplineStudios commented 1 week ago

@ajwfrost Thanks, looks like it's included from one or more of the ANEs -- strange that it builds fine in 51.1 though with the same gradle/AGP! I do notice that the build.gradle file in androidx.activity looks different when packaged with 51.1, and it does include the namespace in that version among other changes.

I may just move on to 51.1 instead, since I'm not sure what I would do with the Android Studio files after adding the namespace. I'm not a Java/Android developer, so all I've ever used Android Studio for is for downloading the latest build tools, and only change Java versions when AIR requires it (and gradle is still a foreign concept!)

marchbold commented 1 week ago

@FliplineStudios Yes I would suggest you move on here. I'd say this is related to the differences in gradle files for the newer gradle versions. They have changed where package names are pulled from I believe and what's required. Unless you have any specific need to stay on 50.2?

FliplineStudios commented 1 week ago

@marchbold Thanks! I'll plan to switch to 51.1 then. The main reason for sticking with 50.2 was just wanting to use a stable release of the AIR SDK -- since I have 28 apps to update and playtest, I'd hate to finish the process and then find out there was an issue with the brand-new SDK and have to update them all again. Once a year is enough for me :)