playgameservices / android-basic-samples

Google Play game services - Android samples
Apache License 2.0
972 stars 970 forks source link

All of the samples failing for IllegalStateException - getApplicationInfo().targetSdkVersion > android.os.Build.VERSION_CODES.LOLLIPOP_MR1 #179

Closed timjax closed 7 years ago

timjax commented 9 years ago

I have not changed anything in the gradles files or the androidmanifest.xml files in terms of the targetsdkversion. I am getting an error in the Activity.java class for the following lines of code (look way down below). GetApplicationInfo().targetSdkVersion returns 23 for all samples and android.os.Build.VERSION_CODES.LOLLIPOP_MR1 is set as 22 so the error below is always thrown. If I set "android_compile_version = 23" in the BasicSample project's build.gradle file to a lower version then I get roughly 98 compilation errors due to not being backwards compatible as it is currently designed. Anyone have an idea how to fix this? I would think everyone would be getting these errors. I am using Android Studio for the builds.

The error is occurring because getApplicationInfo().targetSdkVersion is greater than android.os.Build.VERSION_CODES.LOLLIPOP_MR1 (see below)

if (!mVisibleFromClient && !mFinished) { Log.w(TAG, "An activity without a UI must call finish() before onResume() completes"); if (getApplicationInfo().targetSdkVersion

android.os.Build.VERSION_CODES.LOLLIPOP_MR1) { throw new IllegalStateException( "Activity " + mComponent.toShortString() + " did not call finish() prior to onResume() completing"); } }

It seems to use the targetSDKversion in the line "android_compile_version = 23" in the build.gradle of the BasicSamples project rather than the targetsdkversion which has been set in the androidmanifest.xml file as '19' when the call is made to getApplicationInfo().targetSdkVersion which returns 23.

gguuss commented 8 years ago

Are you still seeing this issue? I have been able to build the samples without issue for a while.