GCM TOKEN REGISTRATION ON ANDROID 2.3 - java

I tried to implement the new Google Cloud Messaging API on an Application i'm working on, it works fine on version 4.2++, i can receive notifications and act on it. But there is a serious issue i experience in version 2.3. or lower versions:
protected void onHandleIntent(Intent intent) {
System.out.println("STARTING SERVICE !!!!! ");
InstanceID instanceID = InstanceID.getInstance(this);
try {
final String token = instanceID.getToken(getString(R.string.sender_id), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
System.out.println("GCM TOKEN :::: " + token);
if(!token.isEmpty()) {
new MyGcmRunner(token, this);
}
}
catch (IOException ex){
ex.printStackTrace();
}
//instanceID.getToken()
}
with the above implementation i receive a GCM TOKEN. The first time i try to send a message to GCM server using this token it returns a successful message, even though the client app doesn't receive any notification.
If i try again it returns the below error:
{"multicast_id":5130293481949972794,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"NotRegistered"}]}
I really don't understand why it behaves like this, is there something i'm missing.
NOTE : The situation occurs in android version 2.3 or lower versions that i'm currently experimenting on.
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.healthboxes.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.healthboxes.app.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/hb_icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</receiver>
<service
android:name=".Authentication.Services.HBInstanceIDListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<service
android:name=".Authentication.Services.RegistrationService"
android:enabled="true"
android:exported="false" />
<service
android:name=".General.Service.GcmMessageListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<activity
android:name=".HBSplashActivity"
android:label="#string/title_activity_hbsplash"
android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Authentication.Activity.HBLoginActivity"
android:label="#string/title_activity_hblogin"
android:parentActivityName=".HBSplashActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.healthboxes.app.HBSplashActivity" />
</activity>
<activity
android:name=".Home.Activity.HBHomeActivity"
android:label="#string/title_activity_hbhome"
android:launchMode="singleTop"
android:parentActivityName=".Authentication.Activity.HBLoginActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.healthboxes.app.Authentication.Activity.HBLoginActivity" />
</activity>
<activity
android:name=".HBAppointment.Activity.HBCreateAppointmentActivity"
android:label="#string/title_activity_create_appointment"
android:parentActivityName=".Home.Activity.HBHomeActivity"
android:windowSoftInputMode="stateHidden" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.healthboxes.app.Home.Activity.HBHomeActivity" />
</activity>
<activity
android:name=".HBRiskChecker.Activity.HBQuestionActivity"
android:label="#string/title_activity_hbquestion"
android:launchMode="singleTop"
android:parentActivityName=".Home.Activity.HBHomeActivity"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.healthboxes.app.Home.Activity.HBHomeActivity" />
</activity>
<activity
android:name=".Authentication.Activity.SignUpActivity"
android:label=""
android:parentActivityName=".Authentication.Activity.HBLoginActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.healthboxes.app.Authentication.Activity.HBLoginActivity" />
</activity>
<activity
android:name=".Authentication.Activity.HBSignUpProcessActivity"
android:label="#string/title_activity_hbsign_up_process"
android:parentActivityName=".Authentication.Activity.SignUpActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.healthboxes.app.Authentication.Activity.SignUpActivity" />
</activity>
<activity
android:name=".Activity.HBDetailActivity"
android:label="#string/title_activity_detail"
android:parentActivityName=".Home.Activity.HBHomeActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.healthboxes.app.Home.Activity.HBHomeActivity" />
</activity>
<activity
android:name=".Chat.Activity.HBChatActivity"
android:label="#string/title_activity_hbchat"
android:parentActivityName=".Home.Activity.HBHomeActivity"
android:windowSoftInputMode="adjustResize|stateHidden" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.healthboxes.app.Home.Activity.HBHomeActivity" />
</activity>
<activity
android:name=".Activity.SearchActivity"
android:label="#string/title_activity_search"
android:parentActivityName=".Home.Activity.HBHomeActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.healthboxes.app.Home.Activity.HBHomeActivity" />
</activity>
<activity
android:name=".Activity.ProfileActivity"
android:label="#string/title_activity_profile"
android:parentActivityName=".Activity.SearchActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.healthboxes.app.Activity.SearchActivity" />
</activity>
<activity
android:name=".Chat.Activity.ChatRequestActivity"
android:label="#string/title_activity_chat_request"
android:exported="true"
android:parentActivityName=".Home.Activity.HBHomeActivity" >
<intent-filter>
<action android:name="CHAT_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.healthboxes.app.Home.Activity.HBHomeActivity" />
</activity>
</application>

You can have added these two permissions for GCM:
<permission
android:name="com.healthboxes.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.healthboxes.app.permission.C2D_MESSAGE" />
Try to add also:
<uses-permission android:name="android.permission.C2D_MESSAGE" />

Related

Flutter app crashing when using social_share and social_share_plugin together

I am facing this issue when trying to share to Facebook Feed using social_share_plugin (https://pub.dev/packages/social_share_plugin).
The app is crashing after showing these errors:
Content provider androidx.core.content.FileProvider already published as com.game.brainybugs.com.shekarmudaliyar.social_share
[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, The authority of the uri content://com.game.brainybugs.social.share.fileprovider/files/share_icon.png does not match the one of the contentProvider: com.game.brainybugs.com.shekarmudaliyar.social_share, null)
My AndroidManifest.xml looks like this
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.game.brainybugs">
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.persmission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Play and Learn English"
android:icon="#mipmap/icon">
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"/>
<meta-data android:name="com.facebook.sdk.ApplicationName"
android:value="#string/app_name"/>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
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="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.com.shekarmudaliyar.social_share"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/filepaths"
tools:replace="android:resource"/>
</provider>
<provider android:authorities="com.facebook.app.FacebookContentProvider0000000000000000"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.social.share.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_paths"
tools:replace="android:resource"/>
</provider>
</application>
</manifest>
where 0000000000000000 is my Facebook App ID obtained from developer.facebook.com
Things I have tried:
Using social_share only - Works
Using social_share_plugin only - Works
I need the ability to share to both Facebook Feed and Whatsapp which has compelled me to use both social_share_plugin and social_share together.

Getting error after updating android studio to 3.2

We are facing an error of default activity is not found after update android studio to version "3.2". On another PC, which is running lower version 3.1.4 of android studio, this same application is working. If anyone has a solution then please suggest us.
I have attached manifest file of screen shot of android studio for that error.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.exmple.com">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar"
android:screenOrientation="portrait" >
</activity>
<activity android:name=".Category_item"
android:screenOrientation="portrait"/>
<activity android:name=".ImageDatail"
android:screenOrientation="portrait"/>
<activity android:name=".SplashScreen"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
<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="your-own-uri" />
</intent-filter>
</activity>
<service android:name=".FireBase.MyFirebaseMessagingService"
android:exported="true"
android:stopWithTask="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name=".FireBase.MyFirebaseInstanceIDService"
android:exported="true"
android:stopWithTask="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<receiver
android:name=".Util.ConnectivityReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.qualifiedapps.inspirationalquotes.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
</application>
</manifest>

Supported devices 0 on play store

I have searched and tried many solutions from stackoverflow,
but i guess am having a different kind of problem.
I have used branch io and sugar orm in my app.
I needed the RECEIVE_SMS & READ_SMS to implement two step authentication and got some map related activity.
Having just uploaded my app to the Play store I get: Supported devices 0 . The app is activated and here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.demo.dlm">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="26" />
<uses-permission android:name="android.permission.INTERNET" android:required="true" />
<uses-permission android:name="android.permission.ACCESS_GPS" android:required="true" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:required="true" />
<uses-permission android:name="android.permisssion.ACCESS_COARSE_LOCATION" android:required="true" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" android:required="true" />
<uses-permission android:name="android.permission.RECEIVE_SMS" android:required="false" />
<uses-permission android:name="android.permission.READ_SMS" android:required="false" />
<meta-data android:name="DATABASE" android:value="clm.db" />
<meta-data android:name="VERSION" android:value="1" />
<meta-data android:name="QUERY_LOG" android:value="true" />
<meta-data android:name="DOMAIN_PACKAGE_NAME" android:value="com.selise.clm.common.database.entity" />
<application
android:name=".common.App"
android:allowBackup="false"
android:fullBackupContent="#xml/my_backup_rules"
android:fullBackupOnly="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:hardwareAccelerated="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".common.ui.activity.SplashScreenActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="clmdebug" android:host="open" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<activity
android:name=".login.ui.activity.LoginActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar">
<!-- Branch URI scheme -->
<intent-filter>
<data
android:host="open"
android:scheme="clm" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_jjuGmW0h4nBkf309aOCBbpikstjXj60T" />
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_live_eetMk3Wl9w5Jo7kd3s3rPifnrzlZ8fp0" />
<activity
android:name=".login.ui.activity.RegistrationActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".shipment.ui.activity.ShipmentListActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".notification.ui.activity.NotificationListActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".notification.ui.activity.NotificationDetailsActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".shipment.ui.activity.AddShipmentActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".shipment.ui.activity.ShipmentDetailsActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<service
android:name=".shipmentMap.service.GeofenceTransitionsIntentService"
android:enabled="true" />
<service android:name=".common.service.AccessTokenWithRefreshTokenService" />
<service android:name=".common.service.LoadLastNotificationService" />
<service
android:name=".notification.service.NotificationSignalRService"
android:enabled="true" />
<service android:name=".shipmentMap.currentLocation.service.SendCurrentLocationService" />
<activity
android:name=".shipmentMap.ui.activity.MapsActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<receiver android:name=".common.receiver.NotificationReceiver">
<intent-filter>
<action android:name="com.selise.clm.SHIPMENT_CHANGED_ROUTE" />
<action android:name="com.selise.clm.SHIPMENT_FORWARD" />
<action android:name="com.selise.clm.SHIPMENT_COMPLETE" />
<action android:name="com.selise.clm.SHIPMENT_CANCELLED" />
<action android:name="com.selise.clm.NOTIFICATION_SERVER_CONNECTED" />
<action android:name="com.selise.clm.NOTIFICATION_SERVER_DISCONNECTED" />
</intent-filter>
</receiver>
<receiver android:name=".common.receiver.AccessTokenAlarmReceiver" android:exported="true"/>
<meta-data android:name="io.fabric.ApiKey" android:value="e7fe0e53b07c82fb5f682d0dddfc8aea6171cda8" />
<!-- Branch init -->
<meta-data
android:name="io.branch.sdk.BranchKey"
android:value="key_live_jjuGmW0h4nBkf309aOCBbpikstjXj60T" />
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_live_eetMk3Wl9w5Jo7kd3s3rPifnrzlZ8fp0" />
<!-- Branch testing (TestMode "true" to simulate fresh installs on dev environment) -->
<meta-data android:name="io.branch.sdk.TestMode" android:value="false" />
<receiver
android:name="io.branch.referral.InstallListener"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<receiver android:name=".login.receiver.SmsReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<activity android:name=".login.ui.activity.EnterSecurityCodeActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"></activity>
</application>
Try to fix a typo here:
<uses-permission android:name="android.permisssion.ACCESS_COARSE_LOCATION" android:required="true" />
You have a permisssion (with 3 s, should be permission instead of permisssion).
As i was using SignalIR in my project. I also added the required jar files. The problem was solved. But double check that after adding packagingOptions your notifications works fine.
I added the following lines in the app gradle file like this...
android {
packagingOptions {
exclude 'lib/getLibs.ps1'
exclude 'lib/getLibs.sh'
exclude 'lib/gson-2.2.2.jar'
}
}

Android Studio Manifest Start and End Tags

I just recently started programming, and encountered a problem. My code seems fine, but Android Studio matches different start tags with end tags. This is my code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="330" android:versionName="3.3 beta" package="com.example.furmanthelegend.nocrastinationapp">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.GET_TASKS" android:maxSdkVersion="24" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:name="android.hardware.sensor.stepcounter" android:required="false" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<application android:theme="null" android:label="NoCrastination" android:icon="res/drawable-mdpi-v4/ic_launcher.png" android:name="de.dfki.nocrastination.utils.NoCrastinationApplication" android:allowBackup="true">
<activity android:label="NoCrastination" android:name="de.dfki.nocrastination.ui.activities.MainActivity" android:excludeFromRecents="true">
<intent-filler>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filler>
</activity>
<activity android:label="Add New Condition" android:name="de.dfki.nocrastination.ui.activities.AddConditionsActivity" android:excludeFromRecents="true" />
<activity android:label="Condition" android:name="de.dfki.nocrastination.ui.activities.ConditionDetailActivity" android:excludeFromRecents="true" />
<activity android:label="App Information" android:name="de.dfki.nocrastination.ui.activities.appinformationActivity" android:excludeFromRecents="true" />
<activity android:label="Recently Used Apps" android:name="de.dfki.nocrastination.ui.activities.previousappsActivity" android:excludeFromRecents="true" />
<activity android:label="Credits" android:name="de.dfki.nocrastination.ui.activities.creditsActivity" android:excludeFromRecents="true" />
<activity android:label="Settings" android:name="de.dfki.nocrastination.ui.activities.settingsactivity" android:excludeFromRecents="true" />
<activity android:name="org.wordpress.passcodelock.PasscodeUnlockActivity" android:windowSoftInputMode="stateHidden" />
<activity android:name="org.wordpress.passcodelock.PasscodeManagePasswordActivity" android:windowSoftInputMode="stateHidden" />
<service android:name="de.dfki.nocrastination.logging.BackgroundService" android:enabled="true" android:exported="false" />
<reciever android:name="de.dfki.nocrastination.logging.BootCompleteReceiver" android:enabled="true" android:exported="false" />
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</reciever>
<provider android:label="NoCrastination" android:name="de.dfki.nocrastination.data.NoCrastinationProvider" android:exported="false" android:authorities="de.dfki.appdetox" />
<service android:label="NoCrastination Laws" android:icon="res/drawable-xhdpi-v4/dcw_ic_extension.png" android:name="de.dfki.nocrastination.dashclockextension.nocrastinationExtension" android:permission="com.google.android.appa.dashclock.premission.READ_EXTENSION_DATA">
<intent-filler>
<action android:name="com.google.android.apps.dashclock.Extension" />
</intent-filler>
<meta-data android:name="protocolVersion" android:value="1" />
<meta-data android:name="description" android:value="Shows current amount of active conditions and condition breaks" />
</service>
<service android:label="NoCrastination" android:name="de.dfki.nocrastination.logging.AppUsageAccesibilityService" android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE" android:enabled="true" >
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data android:name="android.accessibilityservice" android:resource="res/xml/accessibility_service_config.xml" />
</service>
<meta-data android:name="com.crashlytics.ApiKey" android:value="c5cac52287e9abe392fe06e567285ee4aa9ed0bb" />
<receiver android:label="NoCrastination&apos;s device admin" android:name="de.dfki.nocrastination.ui.activities.DeviceAdminSample" android:permission="android.permission.BING_DEVICE_ADMIN" android:description="Prevent stop forcefully">
<meta-data android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
<intent-filler>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filler>
</receiver>
</application>
<manifest>
I am not great at programming, so any tips would be extremely appreciated and helpful. The main problem is that android studio matches and other cases like that.
you use inline close tag and outline also just remove the (/) from the reciever tag, to be:
<reciever android:name="de.dfki.nocrastination.logging.BootCompleteReceiver" android:enabled="true" android:exported="false"> ==> removed "/"
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</reciever>
And add "/" to the last line to be

Android: Unable to instantiate application error

I have this error when running my apk:
09-20 14:08:57.052: E/AndroidRuntime(5430): FATAL EXCEPTION: main
09-20 14:08:57.052: E/AndroidRuntime(5430): java.lang.RuntimeException: Unable to instantiate application com.soinfit.serverAndServices.ErrorReport: java.lang.ClassNotFoundException: Didn't find class "com.soinfit.serverAndServices.ErrorReport" on path: DexPathList[[zip file "/data/app/com.soinfit-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.soinfit-1, /system/lib]]
09-20 14:08:57.052: E/AndroidRuntime(5430): at android.app.LoadedApk.makeApplication(LoadedApk.java:509)
09-20 14:08:57.052: E/AndroidRuntime(5430): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4417)
I have read all the topics about this issue on stackoverflow and no one helped me.
I cleaned my project
Checked order and export
My application project is this class:
package serverAndServices;
import org.acra.ACRA;
import org.acra.ReportField;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import serverAndServices.ServerUtilities;
import android.app.Application;
import com.soinfit.R;
#ReportsCrashes(formKey = "dGVacG0ydVHnaNHjRjVTUTEtb3FPWGc6MQ",
customReportContent = { ReportField.APP_VERSION_CODE,
ReportField.APP_VERSION_NAME, ReportField.ANDROID_VERSION,
ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.BUILD,
ReportField.STACK_TRACE, ReportField.LOGCAT, ReportField.DEVICE_ID }, formUri = ServerUtilities.ERROR_REPORT_FILE, mode = ReportingInteractionMode.TOAST, forceCloseDialogAfterToast = false, // optional,
// default
// false
resToastText = R.string.error_happned)
public class ErrorReport extends Application {
#Override
public void onCreate() {
super.onCreate();
// The following line triggers the initialization of ACRA
ACRA.init(ErrorReport.this);
}
}
In my manifest I have this code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.soinfit"
android:versionCode="36"
android:versionName="1.16" >
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<permission
android:name="com.soinfit.gcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.soinfit.gcm.permission.C2D_MESSAGE" />
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="20" />
<application
android:name=".serverAndServices.ErrorReport"
android:allowBackup="true"
android:configChanges="orientation|keyboardHidden|screenSize|locale"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:debuggable="false"
android:theme="#style/AppTheme" >
<activity
android:name="soInFitMain.SplashScreen"
android:configChanges="keyboardHidden|orientation"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="soInFitMain.ProgramPlay" >
</activity>
<activity android:name="soInFitMain.SocialPage" >
</activity>
<activity android:name="soInFitMain.RegisterPage" >
</activity>
<activity android:name="soInFitMain.FinishProgramPage" >
</activity>
<activity android:name="soInFitMain.ProgramBuilder" >
</activity>
<activity android:name="soInFitMain.BuildProgramScreen" >
</activity>
<activity android:name="soInFitMain.ChooseProgramType" >
</activity>
<activity android:name="soInFitMain.SettingChoosePage" >
</activity>
<activity android:name="soInFitMain.ProfilePage" >
</activity>
<activity android:name="soInFitMain.PersonalDetails" >
</activity>
<activity android:name="soInFitMain.PrivacyPage" >
</activity>
<activity android:name="soInFitMain.HomePage" >
</activity>
<activity android:name="soInFitMain.ProgramSettings" >
</activity>
<activity android:name="soInFitMain.QandA" >
</activity>
<activity android:name="soInFitMain.SentProgramsPage" >
</activity>
<activity android:name="soInFitMain.MyGymPage" >
</activity>
<activity android:name="soInFitMain.UsersInClass" >
</activity>
<activity android:name="soInFitMain.GymMessages" >
</activity>
<activity android:name="soInFitMain.PrivateTrains" >
</activity>
<activity android:name="soInFitMain.TrainerClasses" >
</activity>
<activity android:name="soInFitMain.TrainersInMyGym" >
</activity>
<activity android:name="soInFitMain.ChallengesPage" >
</activity>
<receiver
android:name="serverAndServices.ChallengesActionReceiver"
android:enabled="true" >
<intent-filter>
<action android:name="com.soinfit.utilities.CHALLENGE_CLICK" />
</intent-filter>
</receiver>
<receiver
android:name="serverAndServices.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.GCM_RECEIVED_ACTION" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.soinfit" />
</intent-filter>
</receiver>
<service android:name="serverAndServices.GcmIntentService" />
<service android:name="serverAndServices.OnTheWayCounterService" />
<service android:name="serverAndServices.ProgramTimeCounterService" />
<service android:name="serverAndServices.SetRestTimeCounterService" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/app_id" />
<activity android:name="com.facebook.LoginActivity" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="org.acra.CrashReportDialog"
android:excludeFromRecents="true"
android:finishOnTaskLaunch="true"
android:launchMode="singleInstance"
android:theme="#android:style/Theme.Dialog" />
</application>
</manifest>
My project packages
The package in your custom application is serverAndServices. Making your class serverAndServices.ErrorReport. Android is looking for com.soinfit.serverAndServices.ErrorReport. Which is the name you declared in the manifest. The two should match.

Categories

Resources