Android [SOLVED] Android Builds Failing After GMS2 Update

Toxic Tom

Member
Hi all, I have a project created in GMS2 v2.1.5.322 which was building for Android successfully. Today I updated to GMS2 v2.2.5.481 and cannot build for Android.

I have followed the instructions described in this article: https://help.yoyogames.com/hc/en-us/articles/115001368727-Setting-Up-For-Android-or-Amazon-Fire

There are several errors displayed on the output including "error: package android.support.annotation does not exist" which I have included below (only the end part of the output is included):
Code:
C:\Windows\system32\cmd.exe /c "subst Q: "Z:/Block_Boi_95BA42C5\Android\default" && Q: && cd "com.toxictom.blockboi" && "X:/Android\runner\gradle\gradlew" build  assembleRelease  -x lint  "

> Configure project :com.toxictom.blockboi
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Task :com.toxictom.blockboi:preBuild UP-TO-DATE
> Task :com.toxictom.blockboi:preDebugBuild
> Task :com.toxictom.blockboi:compileDebugAidl NO-SOURCE
> Task :com.toxictom.blockboi:checkDebugManifest
> Task :com.toxictom.blockboi:compileDebugRenderscript NO-SOURCE
> Task :com.toxictom.blockboi:generateDebugBuildConfig
> Task :com.toxictom.blockboi:prepareLintJar
> Task :com.toxictom.blockboi:generateDebugSources
> Task :com.toxictom.blockboi:javaPreCompileDebug
> Task :com.toxictom.blockboi:mainApkListPersistenceDebug
> Task :com.toxictom.blockboi:generateDebugResValues
> Task :com.toxictom.blockboi:generateDebugResources
> Task :com.toxictom.blockboi:mergeDebugResources
> Task :com.toxictom.blockboi:createDebugCompatibleScreenManifests

> Task :com.toxictom.blockboi:processDebugManifest
Q:\com.toxictom.blockboi\src\main\AndroidManifest.xml:30:3-86:17 Warning:
    application@android:label was tagged at AndroidManifest.xml:30 to replace other declarations but no other declaration present
Q:\com.toxictom.blockboi\src\main\AndroidManifest.xml:31:5-40:16 Warning:
    activity#com.toxictom.blockboi.RunnerActivity@android:label was tagged at AndroidManifest.xml:31 to replace other declarations but no other declaration present
Q:\com.toxictom.blockboi\src\main\AndroidManifest.xml:30:3-86:17 Warning:
    application@android:label was tagged at AndroidManifest.xml:30 to replace other declarations but no other declaration present
Q:\com.toxictom.blockboi\src\main\AndroidManifest.xml:31:5-40:16 Warning:
    activity#com.toxictom.blockboi.RunnerActivity@android:label was tagged at AndroidManifest.xml:31 to replace other declarations but no other declaration present

> Task :com.toxictom.blockboi:processDebugResources

> Task :com.toxictom.blockboi:compileDebugJavaWithJavac FAILED
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\AdMobGM.java:28: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GcmBroadcastReceiver.java:7: error: package android.support.v4.content does not exist
import android.support.v4.content.WakefulBroadcastReceiver;
                                 ^
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GcmBroadcastReceiver.java:19: error: cannot find symbol
public class GcmBroadcastReceiver extends WakefulBroadcastReceiver
                                          ^
  symbol: class WakefulBroadcastReceiver
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GcmPush.java:20: error: cannot find symbol
import android.support.v4.app.NotificationCompat;
                             ^
  symbol:   class NotificationCompat
  location: package android.support.v4.app
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GooglePlayServicesExtension.java:13: error: cannot find symbol
import android.support.v4.app.FragmentManager;
                             ^
  symbol:   class FragmentManager
  location: package android.support.v4.app
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GooglePlayServicesExtension.java:18: error: cannot find symbol
import android.support.v4.app.FragmentActivity;
                             ^
  symbol:   class FragmentActivity
  location: package android.support.v4.app
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GcmBroadcastReceiver.java:21: error: method does not override or implement a method from a supertype
    @Override
    ^
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GcmBroadcastReceiver.java:31: error: cannot find symbol
        startWakefulService(context, (intent.setComponent(comp)));
        ^
  symbol:   method startWakefulService(Context,Intent)
  location: class GcmBroadcastReceiver
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GcmBroadcastReceiver.java:32: error: cannot find symbol
        setResultCode(Activity.RESULT_OK);
        ^
  symbol:   method setResultCode(int)
  location: class GcmBroadcastReceiver
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GcmIntentService.java:178: error: cannot find symbol
        GcmBroadcastReceiver.completeWakefulIntent(intent);
                            ^
  symbol:   method completeWakefulIntent(Intent)
  location: class GcmBroadcastReceiver
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GcmPush.java:473: error: package NotificationCompat does not exist
         NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
                           ^
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GcmPush.java:476: error: package NotificationCompat does not exist
         .setStyle(new NotificationCompat.BigTextStyle()
                                         ^
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GcmPush.java:473: error: package NotificationCompat does not exist
         NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
                                                                     ^
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GooglePlayServicesExtension.java:759: error: method CloudResultData in class RunnerJNILib cannot be applied to given types;
                RunnerJNILib.CloudResultData(s.getBytes(), 0 /*STATUS_NEW_GAME_DATA*/, fileId);
                            ^
  required: byte[],byte[],int,int
  found: byte[],int,int
  reason: actual and formal argument lists differ in length
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GooglePlayServicesExtension.java:773: error: method CloudResultData in class RunnerJNILib cannot be applied to given types;
            RunnerJNILib.CloudResultData( null, 0 /*STATUS_NEW_GAME_DATA*/, fileId );
                        ^
  required: byte[],byte[],int,int
  found: <null>,int,int
  reason: actual and formal argument lists differ in length
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GooglePlayServicesExtension.java:894: error: method CloudResultData in class RunnerJNILib cannot be applied to given types;
                                    RunnerJNILib.CloudResultData(s.getBytes(), 0 /*STATUS_NEW_GAME_DATA*/, fileId);
                                                ^
  required: byte[],byte[],int,int
  found: byte[],int,int
  reason: actual and formal argument lists differ in length
Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GooglePlayServicesExtension.java:913: error: method CloudResultData in class RunnerJNILib cannot be applied to given types;
                    RunnerJNILib.CloudResultData( null, 0 /*STATUS_NEW_GAME_DATA*/, fileId );
                                ^
  required: byte[],byte[],int,int
  found: <null>,int,int
  reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Q:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GooglePlayServicesExtension.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
17 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':com.toxictom.blockboi:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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 7s

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
12 actionable tasks: 12 executed


C:\Windows\system32\cmd.exe exited with non-zero status (1)

Does anyone have any suggestions on how I can get the Android build working again?

Thanks,
Tom
 

chirpy

Member
Since 2.2.4 GMS2 had migrated to androidx following Google's push; you'll need to migrate to (delete old and redownload) latest GooglePlayServicesExtension from game options -> android -> general -> add-ons.
For migrating your own .java files, you can find guides here , gradle package mappings here, and class mappings here.

===
That said, I don't understand GMS IDE's android "support library version" settings anymore.. since it should have stopped at 28.0.0 .. we'll need to be able to adjust androidx versions later on.
 

Toxic Tom

Member
Since 2.2.4 GMS2 had migrated to androidx following Google's push; you'll need to migrate to (delete old and redownload) latest GooglePlayServicesExtension from game options -> android -> general -> add-ons.
For migrating your own .java files, you can find guides here , gradle package mappings here, and class mappings here.

===
That said, I don't understand GMS IDE's android "support library version" settings anymore.. since it should have stopped at 28.0.0 .. we'll need to be able to adjust androidx versions later on.
Thanks but where is "game options -> android -> general -> add-ons" ?

game maker android settings.PNG
 

Toxic Tom

Member
Thanks guys! I found the Google Play Services setting, deleted it and reinstalled it but am still getting the error:

Code:
C:\Windows\system32\cmd.exe /c "subst W: "Z:/Block_Boi_95BA42C5\Android\default" && W: && cd "com.toxictom.blockboi" && "X:/Android\runner\gradle\gradlew" build  assembleRelease  -x lint  "
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :com.toxictom.blockboi
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Configure project :dllib
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Configure project :library
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Task :com.toxictom.blockboi:preBuild UP-TO-DATE
> Task :dllib:preBuild UP-TO-DATE
> Task :dllib:preDebugBuild UP-TO-DATE
> Task :dllib:checkDebugManifest
> Task :dllib:processDebugManifest
> Task :library:preBuild UP-TO-DATE
> Task :library:preDebugBuild UP-TO-DATE
> Task :library:checkDebugManifest
> Task :library:processDebugManifest
> Task :library:compileDebugAidl NO-SOURCE
> Task :dllib:packageDebugRenderscript NO-SOURCE
> Task :library:packageDebugRenderscript NO-SOURCE
> Task :com.toxictom.blockboi:prepareLintJar
> Task :dllib:generateDebugBuildConfig
> Task :dllib:generateDebugResValues
> Task :library:compileDebugRenderscript
> Task :library:generateDebugResValues
> Task :library:generateDebugResources
> Task :library:packageDebugResources
> Task :library:generateDebugRFile
> Task :dllib:prepareLintJar
> Task :library:generateDebugBuildConfig
> Task :library:prepareLintJar
> Task :library:generateDebugSources
> Task :dllib:mergeDebugShaders
> Task :dllib:compileDebugShaders
> Task :dllib:generateDebugAssets
> Task :dllib:packageDebugAssets
> Task :library:mergeDebugShaders
> Task :library:compileDebugShaders
> Task :library:generateDebugAssets
> Task :library:packageDebugAssets
> Task :dllib:compileDebugAidl NO-SOURCE
> Task :dllib:compileDebugRenderscript
> Task :dllib:generateDebugResources
> Task :dllib:packageDebugResources
> Task :dllib:generateDebugRFile
> Task :dllib:generateDebugSources
> Task :library:javaPreCompileDebug
> Task :com.toxictom.blockboi:preDebugBuild
> Task :com.toxictom.blockboi:compileDebugAidl NO-SOURCE
> Task :com.toxictom.blockboi:compileDebugRenderscript NO-SOURCE
> Task :com.toxictom.blockboi:checkDebugManifest
> Task :com.toxictom.blockboi:generateDebugBuildConfig
> Task :com.toxictom.blockboi:generateDebugSources

> Task :library:compileDebugJavaWithJavac
Note: W:\library\src\com\google\android\vending\licensing\LicenseChecker.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :library:bundleLibCompileDebug
> Task :dllib:javaPreCompileDebug

> Task :dllib:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :dllib:bundleLibCompileDebug
> Task :com.toxictom.blockboi:javaPreCompileDebug
> Task :com.toxictom.blockboi:mainApkListPersistenceDebug
> Task :com.toxictom.blockboi:generateDebugResValues
> Task :com.toxictom.blockboi:generateDebugResources
> Task :com.toxictom.blockboi:mergeDebugResources
> Task :com.toxictom.blockboi:createDebugCompatibleScreenManifests

> Task :com.toxictom.blockboi:processDebugManifest
W:\com.toxictom.blockboi\src\main\AndroidManifest.xml:35:3-96:17 Warning:
	application@android:label was tagged at AndroidManifest.xml:35 to replace other declarations but no other declaration present
W:\com.toxictom.blockboi\src\main\AndroidManifest.xml:36:5-45:16 Warning:
	activity#com.toxictom.blockboi.RunnerActivity@android:label was tagged at AndroidManifest.xml:36 to replace other declarations but no other declaration present
W:\com.toxictom.blockboi\src\main\AndroidManifest.xml:35:3-96:17 Warning:
	application@android:label was tagged at AndroidManifest.xml:35 to replace other declarations but no other declaration present
W:\com.toxictom.blockboi\src\main\AndroidManifest.xml:36:5-45:16 Warning:
	activity#com.toxictom.blockboi.RunnerActivity@android:label was tagged at AndroidManifest.xml:36 to replace other declarations but no other declaration present

> Task :com.toxictom.blockboi:processDebugResources

> Task :com.toxictom.blockboi:compileDebugJavaWithJavac FAILED
W:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\AdMobGM.java:28: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
W:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\AdMobGM.java:92: error: <anonymous com.toxictom.blockboi.AdMobGM$1$1> is not abstract and does not override abstract method onRewardedVideoCompleted() in RewardedVideoAdListener
        mRewardedVideoAd.setRewardedVideoAdListener(new RewardedVideoAdListener(){
                                                                                 ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: W:\com.toxictom.blockboi\src\main\java\com\toxictom\blockboi\GooglePlayServicesExtension.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':com.toxictom.blockboi:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 38s
40 actionable tasks: 40 executed


C:\Windows\system32\cmd.exe exited with non-zero status (1)
"cmd"  /c subst Z: /d

elapsed time 00:00:00.0259305s for command "cmd" /c subst Z: /d started at 02/13/2020 13:35:07
"cmd"  /c subst Y: /d

elapsed time 00:00:00.0239554s for command "cmd" /c subst Y: /d started at 02/13/2020 13:35:07
"cmd"  /c subst X: /d

elapsed time 00:00:00.0239357s for command "cmd" /c subst X: /d started at 02/13/2020 13:35:07
---------- STOPPING ----------
I fear this may be due to the Kaguva AdMob extension I am using to show AdMob ads as there is mention of "AdMobGM.java" in the output. https://marketplace.yoyogames.com/assets/6614/admob-ondate

It looks like the extension was updated in January 2020, so perhaps updating the extension will solve the issue? Is there a protocol for updating extensions already used in a GMS2 project?
 

Toxic Tom

Member
Update:

I downloaded the new version of Kaguva AdMob, and added it to the project, overwriting any resources that had the same name. The build is now working, and I'm now trying to make the ads show as they did before.

Thanks for the help!
 
Top