I'm developing an App that can be Screen Pinned aka Corporate Owned Single Use aka Lock Task Mode.
If I pin it and then:
I close it (killing it) and then I launch it again
or after some code modification in android studio and then perform Run
restart after pin and unpin
I get the following error:
[homtom-ht3_pro-0123456789ABCDEF]: E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xx.yyy, PID: 7928
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xx.yyy/com.xx.yyy.activities.LauncherActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.xx.yyy/com.xx.yy.activities.StartActivity}; have you declared this activity in your AndroidManifest.xml?
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2534)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2614)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5643)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.xx.yyy/com.xx.yyy.activities.StartActivity}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1788)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)
at android.app.Activity.startActivityForResult(Activity.java:3809)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
at android.app.Activity.startActivityForResult(Activity.java:3760)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859)
at android.app.Activity.startActivity(Activity.java:4090)
at android.app.Activity.startActivity(Activity.java:4058)
at com.xx.yyy.activities.LauncherActivity.onCreate(LauncherActivity.java:16)
at android.app.Activity.performCreate(Activity.java:6099)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2481)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2614)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5643)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
This is my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xx.yyy">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<receiver
android:name=".receivers.DeviceAdminReceiver"
android:description="#string/app_name"
android:label="#string/app_name"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data
android:name="android.app.device_admin"
android:resource="#xml/device_admin_receiver" />
<intent-filter>
<action android:name="android.intent.action.DEVICE_ADMIN_ENABLED" />
<action android:name="android.intent.action.PROFILE_PROVISIONING_COMPLETE" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity android:name=".activities.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.StartActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
If I don't ever pin the app I can restart/upgrade&run it many times I want.
The nice thing is that is not even possible to uninstall the app because it has been configured as Device Owner, and so, it cannot be uninstalled unless a factory reset.
I dont understand how is possible that my activity disappears after an app restart. Can be something related to the intent category or action?
If anyone else encountered this behavior can tell me I will submit an issue to the bug report site.
Thanks.
EDIT 18/3
I think maybe this is happening because at a certain point, I kill the home category activity that in my case is the missing StartActivity in question, and it is not restarted even if I restart the app.
Found the solution in my COSU disable pinning implementation, I was doing:
PackageManager mPackageManager = getApplicationContext().getPackageManager();;
mPackageManager.setComponentEnabledSetting(
new ComponentName(getApplicationContext(), StartActivity.class),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
to disable the pinning on device boot, but this actually disable the specified component.
The correct implementation would be:
PackageManager mPackageManager = getApplicationContext().getPackageManager();;
mPackageManager.setComponentEnabledSetting(
new ComponentName(getApplicationContext(), StartActivity.class),
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
PackageManager.DONT_KILL_APP);
Related
I decided to use Amplify on a school project, after I went through the Login process following this guide: https://docs.amplify.aws/lib/auth/signin/q/platform/android/
And also after adding the social sign in: https://docs.amplify.aws/lib/auth/social_signin_web_ui/q/platform/android/
After following these guides I decided to also add a signout feature and test it out: https://docs.amplify.aws/lib/auth/signOut/q/platform/android/
It should have worked fine but when i lauch the signout method in the guide (literally after copying and pasting it in the project) the app closes as soon as I test it, and it isn't even consistent with the errors, the usual pattern is: it closes, after a while the console says that the signout timed out (obviously) when I reopen the app from the VM it says that it signout successfully then crashes giving this error (the project is called natour):
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.natour, PID: 7330
java.lang.RuntimeException: Unable to resume activity {com.example.natour/com.amazonaws.mobileconnectors.cognitoauth.activities.CustomTabsManagerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.content.Intent.migrateExtraStreamToClipData()' on a null object reference
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3400)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3440)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2713)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.content.Intent.migrateExtraStreamToClipData()' on a null object reference
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1516)
at android.app.Activity.startActivityForResult(Activity.java:4224)
at android.app.Activity.startActivityForResult(Activity.java:4183)
at android.app.Activity.startActivity(Activity.java:4507)
at android.app.Activity.startActivity(Activity.java:4475)
at com.amazonaws.mobileconnectors.cognitoauth.activities.CustomTabsManagerActivity.onResume(CustomTabsManagerActivity.java:69)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1269)
at android.app.Activity.performResume(Activity.java:6766)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3377)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3440)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2713)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
I tried different things, thinking that if the login worked just fine, then something weird happened for the logout redirect uri, but nope, i changed it with "amplify update auth" on the console, changed the callback uri and nothing appened, the same error, the login worked just fine too even though I wrote an activity that wasn't even launched.
I changed the manifest because maybe the custom tab manager activity gave problems but to no avail (meaning it either gives far worse problems to which I know the cause or the same)
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.natour">
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.GET_ACCOUNTS"
android:maxSdkVersion="22" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="natour" />
</intent>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.NaTour">
<activity
android:name=".view.TransazioneRegister"
android:exported="false" />
<activity
android:name=".visualizza_foto_inserite"
android:exported="false" />
<activity
android:name=".visualizza_segnalazioni_effettuate"
android:exported="false" />
<activity
android:name=".visualizza_itinerari_inseriti"
android:exported="false" />
<activity
android:name=".visualizza_recensioni_inserite"
android:exported="false" />
<activity
android:name=".view.InserimentoItinerario"
android:exported="false" />
<activity
android:name=".view.Profile"
android:exported="false" />
<activity
android:name=".view.Register"
android:exported="false" />
<activity
android:name=".view.Login"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".view.VisualizzaItinerario"
android:exported="false" />
<activity
android:name=".view.TabActivity"
android:exported="false" /> <!-- Facebook Requirements -->
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name="com.amplifyframework.auth.cognito.activities.HostedUIRedirectActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="natour"/>
</intent-filter>
</activity>
<activity
android:name=".view.Signout"
android:exported="true">
<intent-filter>
<data android:scheme="natour"/>
</intent-filter>
</activity>
<!--<activity
android:name="com.amazonaws.mobileconnectors.cognitoauth.activities.CustomTabsRedirectActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="natour" />
</intent-filter>
</activity>-->
</application>
</manifest>
this is the manifest in the final attempt, after that i gave up.
I searched this problem online and even though they got pretty close to our problem, either they didn't show the solution, the code is written in other programming language, they didn't explain what was going on. I hope to find some help here, thanks in advance.
I know this has been a while but I found that you need to change launchMode. I tried singleTask it works fine. Maybe singleInstance also works. But I get a time out error: Timed out while waiting for sign-out redirect response.
I found amplify is difficult to deal with because lack of documents and potential bugs, maybe also because not many people use it.
I'd like to disable android.nfc.action.TECH_DISCOVERED IntentFilter depending on users' settings choice,
to avoid the choosing app dialog shows up.
In order to do this, I've created an activity-alias in my Android Manifest file and change its state through PackageManager:
Anroid Manifest File
<activity
android:name=".activities.ActivitySplash"
android:configChanges="orientation"
android:label="#string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity-alias
android:name=".AliasActivitySplash"
android:targetActivity=".activities.ActivitySplash"
android:exported="true"
android:enabled="true">
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
</intent-filter>
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="#xml/techlist"/>
</activity-alias>
Activity Alias State Management:
public void enableAlias() {
int newState = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
_packageManager.setComponentEnabledSetting(new ComponentName(_packageName, _packageName + "." +
"AliasActivitySplash"), newState, PackageManager.DONT_KILL_APP);
}
public void disableAlias() {
int newState = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
_packageManager.setComponentEnabledSetting(new ComponentName(_packageName, _packageName + "." +
"AliasActivitySplash"), newState, PackageManager.DONT_KILL_APP);
}
I get a java.lang.SecurityException everytime i try to change the alias state. I've read installing the app as a system app should solve the issue.
Exception caught:
java.lang.SecurityException: Attempt to change component state; pid=10766, uid=10329, component=packagename/packagename.AliasActivitySplash
at android.os.Parcel.createException(Parcel.java:2071)
at android.os.Parcel.readException(Parcel.java:2039)
at android.os.Parcel.readException(Parcel.java:1987)
at android.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSetting(IPackageManager.java:7336)
at android.app.ApplicationPackageManager.setComponentEnabledSetting(ApplicationPackageManager.java:2554)
at packagename.activities.alias.ActivitySplashAliasManager.disableAlias(ActivitySplashAliasManager.java:27)
at packagename.fragments.FragmentPreferences.onPreferenceChange(FragmentPreferences.java:83)
at androidx.preference.Preference.callChangeListener(Preference.java:1118)
at androidx.preference.TwoStatePreference.onClick(TwoStatePreference.java:67)
at androidx.preference.Preference.performClick(Preference.java:1182)
at androidx.preference.Preference.performClick(Preference.java:1166)
at androidx.preference.SwitchPreferenceCompat.performClick(SwitchPreferenceCompat.java:193)
at androidx.preference.Preference$1.onClick(Preference.java:181)
at android.view.View.performClick(View.java:7140)
at android.view.View.performClickInternal(View.java:7117)
at android.view.View.access$3500(View.java:801)
at android.view.View$PerformClick.run(View.java:27351)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
2019-10-24 09:21:43.863 10766-10766/packagename E/Test: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.pm.PackageManagerService.setEnabledSetting(PackageManagerService.java:21250)
at com.android.server.pm.PackageManagerService.setComponentEnabledSetting(PackageManagerService.java:21184)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:3473)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4015)
at android.os.Binder.execTransactInternal(Binder.java:1021)
Am I doing something wrong or is there any other way to do this?
I've finally solved it. The problem was the way I was getting the packagename. My app has multiple flavor configuration and i was trying to disable/enable a component from the other flavor installed on my device
I am working with the new DirectBoot feature in Android 7.0 and I am trying to determine when the phone is still locked after a restart and in Direct Boot mode. To do this, I have implemented a BroadcastReceiver which I defined in the Manifest.
My understanding is that when a phone is restarted, it sends out an ACTION_LOCKED_BOOT_COMPLETED broadcast when it finishes booting but prior to the user entering their PIN. When the PIN is entered and phone becomes unlocked, an ACTION_BOOT_COMPLETED broadcast is sent. My Receiver works fine if I define its intent-filter to be ACTION_BOOT_COMPLETED, but as soon as I add LOCKED_BOOT_COMPLETED, I get Fatal error messages like this upon restarting the phone saying it couldn't instantiate my receiver:
01-06 07:25:30.917 3872-3872/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.nougatencryptiontest, PID: 3872
java.lang.RuntimeException: Unable to instantiate receiver com.example.nougatencryptiontest.MyReceiver: java.lang.ClassNotFoundException: Didn't find class "com.example.nougatencryptiontest.MyReceiver" on path: DexPathList[[zip file "/data/app/com.example.nougatencryptiontest-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.nougatencryptiontest-1/lib/arm64, /system/lib64, /vendor/lib64]]
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3021)
at android.app.ActivityThread.-wrap18(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1561)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.nougatencryptiontest.MyReceiver" on path: DexPathList[[zip file "/data/app/com.example.nougatencryptiontest-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.nougatencryptiontest-1/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3016)
at android.app.ActivityThread.-wrap18(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1561)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
I'm not sure why this DexPathList issue occurs only when I change my Receiver's intent-filter from BOOT_COMPLETED to LOCKED_BOOT_COMPLETED. Below is my Manifest that does not work (however, if I change intent-filter to just be BOOT_COMPLETED, application doesn't crash and receiver works perfectly fine!):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nougatencryptiontest">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:allowBackup="true"
android:directBootAware="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<receiver android:name=".MyReceiver"
android:exported="true"
android:directBootAware="true">
<!-- Listening the BOOT_COMPLETED action for legacy pre-N devices -->
<intent-filter>
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity android:name=".MainActivity"
android:directBootAware="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Any advice or pointers would be greatly appreciated.
My application was working ok, but after i added the push notifications from parse server, i started getting an error when the app is launched (see message below), while the app open and work ok, when i close the app the same is not doing the background search and notification.
09-30 17:22:12.006 10338-10349/br.com.inconnet.inbeacon E/Parcel: Class not found when unmarshalling: org.altbeacon.beacon.service.StartRMData
java.lang.ClassNotFoundException: org.altbeacon.beacon.service.StartRMData
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at android.os.Parcel.readParcelableCreator(Parcel.java:2404)
at android.os.Parcel.readParcelable(Parcel.java:2358)
at android.os.Message.readFromParcel(Message.java:571)
at android.os.Message.-wrap0(Message.java)
at android.os.Message$1.createFromParcel(Message.java:527)
at android.os.Message$1.createFromParcel(Message.java:525)
at android.os.IMessenger$Stub.onTransact(IMessenger.java:51)
at android.os.Binder.execTransact(Binder.java:453)
Caused by: java.lang.ClassNotFoundException: org.altbeacon.beacon.service.StartRMData
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at android.os.Parcel.readParcelableCreator(Parcel.java:2404)
at android.os.Parcel.readParcelable(Parcel.java:2358)
at android.os.Message.readFromParcel(Message.java:571)
at android.os.Message.-wrap0(Message.java)
at android.os.Message$1.createFromParcel(Message.java:527)
at android.os.Message$1.createFromParcel(Message.java:525)
at android.os.IMessenger$Stub.onTransact(IMessenger.java:51)
at android.os.Binder.execTransact(Binder.java:453)
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
if i remove the following information from my AndroidManifest.xml, the app works ok again.
<meta-data android:name="com.parse.push.gcm_sender_id"
android:value="id:xxxxxx" />
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="br.com.inconnet.inbeacon" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.OPEN" />
<action android:name="com.parse.push.intent.DELETE" />
</intent-filter>
</receiver>
How can i make both work thogeter?
A similar problem has been reported by folks who are bundling their apps with certain other services and the Android Beacon Library. There is no known fix or even a fully understood cause. You can read more about the issue here:
https://github.com/AltBeacon/android-beacon-library/issues/306
One theory is that bundling some services with your app somehow forces other services in the app to run in a separate process, something the Android Beacon Library does not support.
If you have proguard settings enabled, you may want to try disabling them to see if this makes the problem go away.
In my app I want to change the SCREEN_BRIGHTNESS_MODE (and set another value). I added the permission in the AndroidManifest.xml (double checked with other parameters in the file). The value of the mode should be changed, when a button was pressed.
#Override
public void onClick(View v) {
if(on) {
ContentResolver cResolver = getContentResolver();
Settings.System.putInt(cResolver, Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
Settings.System.putInt(cResolver, Settings.System.SCREEN_BRIGHTNESS, 50);
}
}
And the AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<activity
android:name=".FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:theme="#style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The Android device is a Logic Instrument Fieldbook F1 Android-Version 5.0.1
When I try to execute this command I got the following Exception:
08-31 15:29:28.471 16613-16613/com.matodayu.oxo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.matodayu.oxo, PID: 16613 java.lang.SecurityException: Permission denial: writing to settings requires android.permission.WRITE_SETTINGS
at android.os.Parcel.readException(Parcel.java:1540)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
at android.content.ContentProviderProxy.call(ContentProviderNative.java:643)
at android.provider.Settings$NameValueCache.putStringForUser(Settings.java:1094)
at android.provider.Settings$System.putStringForUser(Settings.java:1371)
at android.provider.Settings$System.putIntForUser(Settings.java:1476)
at android.provider.Settings$System.putInt(Settings.java:1470)
at com.matodayu.oxo.FullscreenActivity$4$1.run(FullscreenActivity.java:184)
at android.app.Activity.runOnUiThread(Activity.java:5285)
at com.matodayu.oxo.FullscreenActivity$4.onClick(FullscreenActivity.java:179)
at android.view.View.performClick(View.java:4809)
at android.view.View$PerformClick.run(View.java:20123)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5534)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
Can anyone help me?
Where did you defined your permissions?
Inside the manifest or application tag?
I made a Test-Project and it works.
It just failed when i added the permission inside the wrong position - e.g. the application tag.