AdMob InterstitialAdd not showing in 8.0.0 - android

java.lang.RuntimeException: Unable to start activity ComponentInfo{bible.bibleinbasicenglish/com.google.android.gms.ads.AdActivity}: java.lang.IllegalStateException: Only fullscreen activities can request orientation
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.IllegalStateException: Only fullscreen activities can request orientation
at android.os.Parcel.readException(Parcel.java:1950)
at android.os.Parcel.readException(Parcel.java:1888)
at android.app.IActivityManager$Stub$Proxy.setRequestedOrientation(IActivityManager.java:5675)
at android.app.Activity.setRequestedOrientation(Activity.java:5739)
at com.google.android.gms.ads.internal.overlay.m.a(:com.google.android.gms.DynamiteModulesA:553)
at com.google.android.gms.ads.internal.overlay.m.b(:com.google.android.gms.DynamiteModulesA:626)
at com.google.android.gms.ads.internal.overlay.m.a(:com.google.android.gms.DynamiteModulesA:341)
at com.google.android.gms.ads.internal.overlay.client.c.onTransact(:com.google.android.gms.DynamiteModulesA:58)
at android.os.Binder.transact(Binder.java:604)
at com.google.android.gms.internal.zzfv$zza$zza.onCreate(Unknown Source:27)
at com.google.android.gms.ads.AdActivity.onCreate(Unknown Source:24)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
here is the error log of Interstital ad when open app it will directall crash, i currently test add in the api Level 26, The error like Only fullscreen activities can request orientation , idont know why this is happening.
is there any soluthion for this ? then help me.

EDIT
the newer (above 16) admob version fixed the issue
Old Answer
add this in your manifest
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
tools:replace="android:theme"
/>

just simply add this line in your gradle file
targetSdkVersion = 26

If your target SDk version >= 27 then you get this error so try to add below code
void setRequestedOrientation(int requestedOrientation) {
if (ActivityInfo.isFixedOrientation(requestedOrientation) && !fullscreen
&& appInfo.targetSdkVersion > O) {
throw new IllegalStateException("Only fullscreen activities can request orientation");
....
}
for more check this link

Related

Chuck IncompatibleClassChangeError

I make a simple app, that uses http. For debug previously I used Chuck library. But now, when I try to open http-package from Chuck I get exception and I don't understand why.
You can see the project here: https://github.com/FirstSpectr/Sandbox
Process: ru.spectr.kotlinsandbox, PID: 4699
java.lang.IncompatibleClassChangeError: Class 'com.readystatesoftware.chuck.internal.ui.TransactionActivity' does not implement interface 'androidx.lifecycle.LifecycleOwner' in call to 'androidx.lifecycle.Lifecycle androidx.lifecycle.LifecycleOwner.getLifecycle()' (declaration of 'androidx.lifecycle.LiveData' appears in /data/app/ru.spectr.kotlinsandbox-cFhy1fESF3ecXGlmQrM-Yg==/base.apk!classes2.dex)
at androidx.lifecycle.LiveData.observe(LiveData.java:172)
at androidx.loader.app.LoaderManagerImpl$LoaderInfo.setCallback(LoaderManagerImpl.java:100)
at androidx.loader.app.LoaderManagerImpl.createAndInstallLoader(LoaderManagerImpl.java:400)
at androidx.loader.app.LoaderManagerImpl.initLoader(LoaderManagerImpl.java:421)
at com.readystatesoftware.chuck.internal.ui.TransactionActivity.onCreate(TransactionActivity.java:91)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)```
I found problem dependency:
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
After deleted chuck work fine

Getting issue while AOSP – CREATING A SYSTEM SERVICE

I am new in the development of the AOSP environment. I'm trying to create a system service using the following url (sample source code)
http://devarea.com/aosp-creating-a-system-service,
I'm receiving a problem when I'm running the application:
Logcat error message:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.bojojnav.sampleserviceapp/com.example.bojojnav.sampleserviceapp.MainActivity}: java.lang.IllegalStateException: Failed to find ISampService by name [com.android.sampservice.ISampService]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalStateException: Failed to find ISampService by name [com.android.sampservice.ISampService]
at com.android.sampservice.SampManager.<init>(SampManager.java:43)
at com.android.sampservice.SampManager.getInstance(SampManager.java:18)
at com.example.bojojnav.sampleserviceapp.MainActivity.onCreate(MainActivity.java:16)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
please help me to resolve issue.

App crashing on InMobi interstitial ads

I am facing a issue with Interstitial ads, app get crashed when I show the interstitial ad on Android 8.0. On previous version it works fine. I am getting following exception:
03-12 15:20:25.524 1894-5833/system_process E/ActivityManager: Activity Manager Crash. UID:10085 PID:24871 TRANS:63
java.lang.IllegalStateException: Only fullscreen activities can request orientation
at com.android.server.am.ActivityRecord.setRequestedOrientation(ActivityRecord.java:2198)
at com.android.server.am.ActivityManagerService.setRequestedOrientation(ActivityManagerService.java:4947)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:1101)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2935)
at android.os.Binder.execTransact(Binder.java:674)
03-12 15:20:25.535 24871-24871/com.my.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.my.app, PID: 24871
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.app/com.google.android.gms.ads.AdActivity}: java.lang.IllegalStateException: Only fullscreen activities can request orientation
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.IllegalStateException: Only fullscreen activities can request orientation
at android.os.Parcel.readException(Parcel.java:1950)
at android.os.Parcel.readException(Parcel.java:1888)
at android.app.IActivityManager$Stub$Proxy.setRequestedOrientation(IActivityManager.java:5675)
at android.app.Activity.setRequestedOrientation(Activity.java:5739)
at com.google.android.gms.ads.internal.overlay.d.a(:com.google.android.gms.DynamiteModulesA#11947470:182)
at com.google.android.gms.ads.internal.overlay.d.b(:com.google.android.gms.DynamiteModulesA#11947470:216)
at com.google.android.gms.ads.internal.overlay.d.a(:com.google.android.gms.DynamiteModulesA#11947470:76)
at com.google.android.gms.ads.internal.overlay.client.c.onTransact(:com.google.android.gms.DynamiteModulesA#11947470:8)
at android.os.Binder.transact(Binder.java:604)
at com.google.android.gms.internal.zzeu.zzb(Unknown Source:7)
at com.google.android.gms.internal.zzxg.onCreate(Unknown Source:8)
at com.google.android.gms.ads.AdActivity.onCreate(Unknown Source:29)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
Following is the InMobiAdActivity in manifest:
<activity
android:name="com.inmobi.rendering.InMobiAdActivity"
android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize|screenLayout"
android:hardwareAccelerated="true"
android:resizeableActivity="false"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
tools:ignore="UnusedAttribute" />
Anybody please help me out to solve this issue. Thanks in advance

SweetAlertDialog error after updating Android Studio 3.0 and Gradle version 4.1

After the update, my application did not make any mistakes, but when I opened the emulator, I could not find the SweetAlertDialog library.Debug mode instead of release apk I tried it on the emulator this time it worked and did not give an error.I do not understand why it gives an error while in Debug mode.
FATAL EXCEPTION: main
Process: com.dinlenet, PID: 7427
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dinlenet/com.dinlenet.activitys.PermissionActivity}: java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:null
at cn.pedant.SweetAlert.OptAnimationLoader.createAnimationFromXml(OptAnimationLoader.java:77)
at cn.pedant.SweetAlert.OptAnimationLoader.createAnimationFromXml(OptAnimationLoader.java:64)
at cn.pedant.SweetAlert.OptAnimationLoader.createAnimationFromXml(OptAnimationLoader.java:41)
at cn.pedant.SweetAlert.OptAnimationLoader.loadAnimation(OptAnimationLoader.java:22)
at cn.pedant.SweetAlert.SweetAlertDialog.<init>(SweetAlertDialog.java:80)
at com.dinlenet.utils.DialogUtil.showSweetAlertDialogWithListener(DialogUtil.java:27)
at com.dinlenet.utils.RuntimePermissionsActivity.onCreate(RuntimePermissionsActivity.java:30)
at com.dinlenet.activitys.PermissionActivity.onCreate(PermissionActivity.java:25)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6541) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
10-29 08:30:49.083 7427-7427/com.dinlenet E/CrashlyticsCore: Failed to execute task.
add this library is the same just with new features https://jitpack.io/p/Leogiroux/sweet-alert-dialog
try to add this line to your proguard file:
-keep class cn.pedant.SweetAlert.** { *; }
Reference of this Error solution. This is from Git Error issue page of SweetAlaert.
Remove the dependency from build.graddle and add it as a module as shown here:
https://github.com/pedant/sweet-alert-dialog/issues/148
This Library is not maintained
To solve this issue
Modify the File OptAnimationLoader
Add another else condition / case
case "YOURPATH.Rotate3dAnimation":
anim = new Rotate3dAnimation(c, attrs);
break;

Failed to Enable AutoFill Service by using Intent in Android O

I used this code for enabling the Enable AutoFill Service.
Intent dialogIntent = new Intent(Settings.ACTION_REQUEST_SET_AUTOFILL_SERVICE);
startActivity(dialogIntent);
I got the next exception:
FATAL EXCEPTION: main
Process: com.example.android.autofillframework, PID: 7683
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.autofillframework/com.example.android.autofillframework.app.StandardSignInActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.REQUEST_SET_AUTOFILL_SERVICE }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.REQUEST_SET_AUTOFILL_SERVICE }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1936)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1615)
at android.app.Activity.startActivityForResult(Activity.java:4472)
at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:65)
at android.app.Activity.startActivityForResult(Activity.java:4430)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:711)
at android.app.Activity.startActivity(Activity.java:4791)
at android.app.Activity.startActivity(Activity.java:4759)
at com.example.android.autofillframework.app.StandardSignInActivity.onCreate(StandardSignInActivity.java:53)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
You're missing the package name in the intent. From the javadoc:
Input: Intent's data URI set with an application name, using the "package" schema (like "package:com.my.app").
You're missing the package name in the intent. pass your app package name in intent.setData().
like:
Intent intent = new Intent(android.provider.Settings.ACTION_REQUEST_SET_AUTOFILL_SERVICE);
intent.setData(Uri.parse("package:<YOUR_APP_PACKAGE_NAME>"));
startActivity(intent)
On Huawei devices, it seems like this even happens if you check correctly for hasEnabledAutofillServices() and isAutofillSupported() and if you include the package.

Categories

Resources