ERROR getting 'name' attribute: attribute is not a string value - android

Uploading my apk file to google play makes this error:
Your APK cannot be analyzed using aapt. Error output: Failed to run
aapt dump badging: ERROR getting 'name' attribute: attribute is not a
string value
Since I know that this problem is within my manifest file, I have put it here:
AndroidManifext.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ir.altontech.newsimpay">
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<permission
android:name="ir.altontech.newsimpay.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="ir.altontech.newsimpay.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application xmlns:tools="http://schemas.android.com/tools"
android:name="ir.altontech.newsimpay.Classes.Model.AnalyticsApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="false"
android:theme="#style/AppTheme"
tools:replace="android:supportsRtl">
<receiver
android:name="com.adjust.sdk.AdjustReferrerReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<receiver android:name=".Receivers.SmsListener">
<intent-filter android:priority="1000">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<receiver
android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false" />
<activity
android:name="ir.altontech.newsimpay.Activities.Introduction"
android:screenOrientation="portrait" />
<activity
android:name="ir.altontech.newsimpay.Activities.Main"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:taskAffinity="ir.altontech.simpay"
android:theme="#style/AppTheme"
android:windowSoftInputMode="adjustPan"/>
<activity
android:name=".Activities.SpecificPage"
android:screenOrientation="portrait">
<intent-filter>
<data
android:host="ir.altontech.simpay.specific"
android:scheme="simpay" />
<data
android:host="ad.simpay.ir"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Activities.SplashActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:taskAffinity="ir.altontech.simpay"
android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Activities.FastCharge"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:taskAffinity="ir.altontech.simpay"
android:theme="#style/fast_charge_theme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="ir.altontech.newsimpay.Activities.BarcodeScanner" />
<activity
android:name="ir.altontech.newsimpay.Activities.FinalTrainTicket"
android:screenOrientation="landscape" />
<activity
android:name="ir.altontech.newsimpay.Activities.VideoPlayer"
android:screenOrientation="landscape"
android:taskAffinity="ir.altontech.simpay" />
<activity android:name="ir.altontech.newsimpay.Activities.CallBack">
<intent-filter>
<data
android:host="ir.altontech.simpay.callback"
android:scheme="simpay" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service
android:name=".Classes.Services.GCMService"
android:exported="false" />
<receiver
android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.analytics.CampaignTrackingService"
android:enabled="true"
android:exported="false" />
<!-- services -->
<!-- registration process service -->
<service
android:name="ir.altontech.cloudmessaging.core.registrationprocess.RegistrationProcessService"
android:exported="false">
<intent-filter>
<action android:name="co.shariftech.pushnotification.intent.action.START_PUSH_NOTIFICATION_SERVICE" />
</intent-filter>
</service>
<!-- registration process token refresher service -->
<service
android:name="ir.altontech.cloudmessaging.core.registrationprocess.RegistrationProcessTokenRefresherService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<!-- push notification service -->
<service
android:name="ir.altontech.cloudmessaging.core.pushnotification.PushNotificationService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<!-- receivers -->
<!-- google cloud messaging receiver -->
<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" />
<category android:name="ir.altontech.newsimpay" />
</intent-filter>
</receiver>
</application>
</manifest>
I have checked all android:name attributes and couldn't find the problem. Thank you all.

so after searching a little I have found three options for you to do:
1- if you have something as follows (which I see you don't ):
<intent-filter>
<action android:name="#string/alarm_auto_sync" >
</intent-filter>
you should hard code the string and remove #string
2- follow this bug to see what could and have been done to solve this issue as I found out this might be the bug of
aapt dump badging
3- if you have values-fa and values-en and other string values as such you should copy your android:name to values.
for more information on these options visit this question or this question
hope this helps

You can go for below suggested link. I hope it helps you.
aapt ERROR getting 'android:name' attribute: attribute is not a string value
Thank you

I think this issue is for different reasons for different people. But in all cases it is the android:name attribute that needs to be investigated. When I encountered it and read some of the replies here, I found mine. Adding it here, just so that it can help someone in future.
<intent-filter>
<action android:name="#string/broadcast_action" />
</intent-filter>
I had defined broadcast_action in strings.xml It worked when I changed that to a hardcoded string. AAPT does not accept a string reference here.

All thing seems good in your AndroidManifest.xml except xmlns:tools="http://schemas.android.com/tools" position. Please give a try by moving xmlns:tools="http://schemas.android.com/tools" from <application></application> tag to <manifest></manifest> tag like this.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ir.altontech.newsimpay"
xmlns:tools="http://schemas.android.com/tools">
<application
android:name="ir.altontech.newsimpay.Classes.Model.AnalyticsApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="false"
android:theme="#style/AppTheme"
tools:replace="android:supportsRtl">
</application>
Hope this will work for you :)

check this link from google
android:name="string"
the document says , your syntax of android:name element should be String .
i think , your manifest file project is good . check your manifest library .maybe you add some library and get this error . also check your project and your library have android:name element .
hope this help you .

This is how you have defined your custom permission:
<permission
android:name="ir.altontech.newsimpay.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
But in the docs you can see:
You need to supply both a label and description for the permission.
I'm not sure whether this may be the case, but at least docs urge you to define label and description.

If you are using any library project as module in your project that having
android:label="#string/app_name"
in their string.xml file then it may coause of your problem.
So your pass hardcode app name in your manifest file for app name like below.
android:label="PASS YoUR APP NAME HERE not from string.xml"

If your app is multi-lingual, then make sure you have provided the translatable as false in the string.xml or provide the app_name in the other files as well. I too got this error once and that was the cause.

may be on of your class had been moved to another package check if all of your classes are in the same package path like manifest
android:name="ir.altontech.cloudmessaging.core.pushnotification.PushNotificationService"

First of all, try to follow java naming convention
Since from your code I cant realy tell is your Application Class an Enclosing class
Try using .Classes.Model.AnalyticsApplication instead of ir.altontech.newsimpay.Classes.Model.AnalyticsApplication

For me the issue was that the broadcast intent-filter name which was referenced from the string file was deleted.
If you are using multi-module project check all manifest in Android Studio to see an error. android:name can refer to any android:name attribute, not just the one in application tag.
Merged manifest can be found at
app/build/intermediates/merged_manifest/<flavour>

In Android we need to assign the strings through string.xml file.
String name - "xyz app"
this is not the recommended approach
String name = "#string/app_name"
In String.xml Store this name as
<string name="app_name">xyz app</string>
complete in android programming we need to follow this approach for using strings

Related

Google Play. Publish status: Rejected

My app rejected by Google Play 3 times.
This is mail that they sent me:
In previous versions of the app, there were some permissions that I didn't request, I thought that was a problem and deleted those permissions and resubmitted the app and again I got rejected
My app asked to set the app as the Default Phone after signing up and if the user didn't set the app as the Default Phone, the app asked for some permissions.
This is my manifest file:
<?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.xxxxxx.xxxxxx">
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<application
android:name=".MyApplication"
android:allowBackup="false"
android:dataExtractionRules="#xml/data_extraction_rules"
android:fullBackupContent="#xml/backup_rules"
android:hardwareAccelerated="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.XXXX.Light"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".AuthActivity"
android:exported="true"
android:hardwareAccelerated="true"
android:theme="#style/Theme.App.Starting"
android:windowSoftInputMode="stateVisible|adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:configChanges="fontScale|density"
android:exported="false"
android:hardwareAccelerated="true"
android:windowSoftInputMode="stateVisible|adjustResize">
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
</activity>
<!-- <meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />-->
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<meta-data
android:name="com.facebook.sdk.ClientToken"
android:value="#string/facebook_client_token" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="#color/primary" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#drawable/ic_launcher_foreground" />
<service
android:name=".core.service.AppFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver
android:name=".core.service.CallReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
</receiver>
</application>
</manifest>
In main they wrote that app "Requested permissions do not match core functionality of the app"
but the app needs all permissions.
- this permission need to connect with the backend
- this one is for reading contacts and showing to user
- this one is for adding new contacts this is also app functionality
- this one is for reading calls and showing to the user
- this one is for get images from gallery and setting to avatar
- and this one for call from app
What is a problem, can someone help me?
You can re request the review with explaining all the use cases for all the permissions. Also check that you have selected that correct category in the Google play console in the app description(Maybe select something similar to Phone dialier)
I also found one issus in the manifest file is that it uses usesCleartextTraffic which transports says that app uses http API which is not encrypted in transit. Since you are dealing with lots of sensitive data yoi should also remove that flag

Problem with android manifest when creating flutter appbundle

I have a problem with the android xml file when creating the appBundle. However, I cannot find the problem, could anyone help me please? I have never removed anything from the file. I have never really worked with manifest files before, so I wasn't completely sure what I was looking for.
Thanks in advance
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="-----------------">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name=".Application"
android:label="Pravachaka Sabdam"
android:icon="#mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
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"
android:showWhenLocked="true"
android:turnScreenOn="true"
>
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<uses-permission android: name="android.permission.INTERNET" android:maxSdkVersion="28" />
</manifest>
Error Message
Error parsing LocalFile: 'A:\Flutter\BETA TEST FOLDER\Android\one\android\app\src\main\AndroidManifest.xml' Please ensure that the android manifest is a valid XML document andtry again.
Ok, you have a space character between android and name while defining internet permission. You need to remove that:
<uses-permission android:name="android.permission.INTERNET" android:maxSdkVersion="28" />
I was able to find the issue.
The issue was that there was an unnecessary space after android here:
<uses-permission android: name="android.permission.INTERNET" android:maxSdkVersion="28" />
I changed this to :
<uses-permission android:name="android.permission.INTERNET" android:maxSdkVersion="28" />

Android App incompatible with all devices

Android Developer Console says my app is incompatible with all devices. However it is tight lipped as to why. Near as I can tell the reason is, according to an article I read, most likely from my android manifest being messed up. But I can't seem to figure out why. I have another app in the app store which is compatible with everything. So what's the issue?
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="Writing Analyzer"
android:roundIcon="#mipmap/ic_launcher_round"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ResultsActivity"/>
</application>
Edit: Some more info
-Minimum SDK is 15
-I am only using one external library, OpenNLP
-As part of OpenNLP I have a model in the assets folder
-I have a class that extends BaseListAdapter
Edit: Here is the full merged manifest. Sorry didn't realize at first that would be needed.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="3"
android:versionName="2.0"
package="textsnoop.rddigi.com.textstats"
platformBuildVersionCode="25"
platformBuildVersionName="7.1.1">
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="25" />
<meta-data
android:name="android.support.VERSION"
android:value="25.3.0" />
<uses-permission
android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.WAKE_LOCK" />
<uses-permission
android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="textsnoop.rddigi.com.textstats.permission.C2D_MESSAGE"
android:protectionLevel="0x2" />
<uses-permission
android:name="textsnoop.rddigi.com.textstats.permission.C2D_MESSAGE" />
<application
android:theme="#ref/0x7f0800a3"
android:label="Writing Analyzer"
android:icon="#ref/0x7f030000"
android:allowBackup="true"
android:supportsRtl="true"
android:roundIcon="#ref/0x7f030001">
<activity
android:name="textsnoop.rddigi.com.textstats.MainActivity">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="textsnoop.rddigi.com.textstats.ResultsActivity" />
<activity
android:theme="#ref/0x0103000f"
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="0xfb0" />
<activity
android:theme="#ref/0x7f080111"
android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity" />
<activity
android:theme="#ref/0x01030010"
android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:exported="false" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true"
android:exported="false" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver"
android:permission="android.permission.INSTALL_PACKAGES"
android:enabled="true">
<intent-filter>
<action
android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false" />
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:permission="com.google.android.c2dm.permission.SEND"
android:exported="true">
<intent-filter>
<action
android:name="com.google.android.c2dm.intent.RECEIVE" />
<action
android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category
android:name="textsnoop.rddigi.com.textstats" />
</intent-filter>
</receiver>
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" />
<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService"
android:exported="true">
<intent-filter
android:priority="-500">
<action
android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:exported="false"
android:authorities="textsnoop.rddigi.com.textstats.firebaseinitprovider"
android:initOrder="100" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#ref/0x7f0c0003" />
</application>
Please check your permissions and features in manifest file. Especially if you're mentioning any feature/permission that has required attribute e.g: <
uses-permission android:name="android.permission.READ_PHONE_STATE" android:required="true"/>
Remove the "android:required=true " part then it should work fine in Play Store.
I don't know exactly what caused the change, but I went through and cleaned the project with lint. I also removed a call to the apache commons io from the app. I suspect that is most likely the issue.
A possible reason for this is that your minimum API level is high, leading to your app being incompatible with many devices. Checkout:
Changing API level Android Studio if you want to change your minimum API level.
Try setting all the uses-feature"-tags to false
Try removing all permissions (I know the app won't work without them, but just for the sake of figuring out why Google Play says that the app supports 0 devices)

OUTDATED DEVICE: Parse Push Notification to Android devices

Hi have worked with parse for saving data. But notification is something i am stuck with. I am not able figure out what's going wrong.
I have done all the receiver registrations and so my device also gets registered in the installation table but while sending push from web console it says "push sent 0" looking into the description of each push it shows that "OUTDATED DEVICE - The records on this installation are outdated, the user might have uninstalled the app." But I just did the registration.
I am going mad with this...no clue in what am I doing wrong, I am using eclipse IDE, Can anyone please suggest me any Solution??
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.parsecomlogin"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.example.parsecomlogin.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.parsecomlogin.permission.C2D_MESSAGE" />
<permission
android:name="com.example.parsecomlogin.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.parsecomlogin.permission.MAPS_RECEIVE" />
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<application
android:name=".ParseApp"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Added for Parse push notifications -->
<!-- My custom receiver -->
<receiver
android:name=".ParseReceiver"
android:enabled="true"
android:exported="false" >
<intent-filter>
<action android:name="com.example.parsecomlogin.RECEIVE_PUSH" />
</intent-filter>
</receiver>
<!-- END my custom receiver -->
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</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.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<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="com.example.parsecomlogin" />
</intent-filter>
</receiver>
<activity
android:name=".Welcome"
android:label="#string/title_activity_welcome" >
</activity>
<activity
android:name=".LoginActivity"
android:label="#string/title_login" >
</activity>
<activity
android:name=".LoginSignupActivity"
android:label="#string/title_activity_login_signup" >
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDZ5TG28QJnN5zMyIdezPllvrfrwg7ElQs" />
</application>
</manifest>
I faced exactly the same problem and I fixed it a few minutes ago by coincidence. I hope the problem can be solved with the same touch-up for you as well.
In my situation, I used one of the older projects I worked and I have changed manifest package name manually in a way. In AndroidManifest.xml file, the manifest package name was changed to "com.myprojectname". There was no problem and app can run without any error with this package name. Also, all of Parse features run problem-free except push notification service. Then I checked other paths with Ctrl + Shift + R and searched whether R.java uses the same name. Unsurprisingly, the package name was identical in this file but I realized that in the lines below R.java uses the pattern of "net.myprojectname.app" instead of "com.myprojectname". I replaced "com.myprojectname" with "net.myprojectname.app" in all files by using Ctrl + Shift + R again. I think it was not the cause of the problem but I tried to send a last push notification desperately. It is hard to believe but it is worked. I got the notification successfully after all.
I answered the question in a highly informal and non-technical way but I have no idea about the underlying cause, I just want to help. Maybe it works for you. Good luck.

Registering a content provider

I have been trying to create a copy of Android's ContactsProvider. I wanted to make minimal changes to the provider as most of my work will be in another app which will use the data. However, I want to ensure the real contacts are not accessible to the app I am making so I planned to create a copy of the provider. After successfully navigating though the process of creating a copy provider with a different authority, I tried to call my copied provider. At this point I got two errors.
The first one was in my own app where I got the error "Failed to find provider info for 'ContentProvider'" I read this answer for that but I had taken care of everything mentioned here already.
The second error happens in my provider: java.lang.NoClassDefFoundError: com.google.common.collect.ImmutableSet$Builder This is probably the reason why I am getting the first error. Because my provider is never able to access the classes that are internal to Android, it is not getting registered as a valid provider and thus my app is not able to "find" the provider.
Here is my Manifest file for the ContactManager:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.prajitdas.contactmanager"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.prajitdas.contactmanager.ContactManager"
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="ContactAdder" android:label="#string/addContactTitle">
</activity>
</application>
</manifest>
and the manifest file for the ContactsProvider:-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.prajitdas.android.providers.contacts"
android:versionCode="2"
android:versionName="2.0">
<permission
android:name="com.android.voicemail.permission.READ_WRITE_ALL_VOICEMAIL"
android:label="#string/read_write_all_voicemail_label"
android:description="#string/read_write_all_voicemail_description"
android:permissionGroup="android.permission-group.PERSONAL_INFO"
android:protectionLevel="system|signature"
/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BIND_DIRECTORY_SEARCH" />
<uses-permission android:name="android.permission.UPDATE_APP_OPS_STATS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL" />
<uses-permission android:name="com.android.voicemail.permission.READ_WRITE_ALL_VOICEMAIL" />
<application android:process="android.process.acore"
android:label="#string/app_label"
android:icon="#drawable/app_icon"
android:allowBackup="true">
<!-- Modified provider authority -->
<provider android:name="ContactsProvider2"
android:authorities="fakecontacts;com.prajitdas.android.providers.contacts"
android:label="#string/provider_label"
android:multiprocess="false"
android:exported="true"
android:readPermission="android.permission.READ_CONTACTS"
android:writePermission="android.permission.WRITE_CONTACTS">
<path-permission
android:pathPrefix="/search_suggest_query"
android:readPermission="android.permission.GLOBAL_SEARCH" />
<path-permission
android:pathPrefix="/search_suggest_shortcut"
android:readPermission="android.permission.GLOBAL_SEARCH" />
<path-permission
android:pathPattern="/contacts/.*/photo"
android:readPermission="android.permission.GLOBAL_SEARCH" />
<grant-uri-permission android:pathPattern=".*" />
</provider>
<provider android:name="CallLogProvider"
android:authorities="fakecall_log"
android:syncable="false" android:multiprocess="false"
android:exported="true"
android:readPermission="android.permission.READ_CALL_LOG"
android:writePermission="android.permission.WRITE_CALL_LOG">
</provider>
<provider android:name="VoicemailContentProvider"
android:authorities="com.prajitdas.android.voicemail"
android:syncable="false" android:multiprocess="false"
android:exported="true"
android:permission="com.android.voicemail.permission.ADD_VOICEMAIL">
</provider>
<!-- Handles database upgrades after OTAs, then disables itself -->
<receiver android:name="ContactsUpgradeReceiver">
<!-- This broadcast is sent after the core system has finished
booting, before the home app is launched or BOOT_COMPLETED
is sent. -->
<intent-filter>
<action android:name="android.intent.action.PRE_BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<receiver android:name="PackageIntentReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<data android:scheme="package" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_CHANGED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<receiver android:name="LocaleChangeReceiver">
<intent-filter>
<action android:name="android.intent.action.LOCALE_CHANGED"/>
</intent-filter>
</receiver>
<service android:name="VoicemailCleanupService"/>
<activity android:name=".debug.ContactsDumpActivity"
android:label="#string/debug_dump_title"
android:theme="#android:style/Theme.Holo.Dialog"
>
<intent-filter>
<action android:name="com.prajitdas.android.providers.contacts.DUMP_DATABASE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<provider android:name=".debug.DumpFileProvider"
android:authorities="com.prajitdas.android.providers.contacts.dumpfile"
android:exported="true">
</provider>
</application>
</manifest>
As you can see, I have basically copied the original manifest files and modified it to the new authorities for my provider. I have done the same for the java code, but it is too big to post here. If anyone can help me identify the steps to either make the android internal calls work or maybe resolve the first problem of "registering" the provider on a phone somehow, it would be much appreciated.
com.google.common.collect.ImmutableSet$Builder isn't actually an internal Android class. It is a part of the Google's Guava library. You need to add Guava's JAR as a dependency to your project to compile it (and, probably, some others dependencies, check the list for the ContactsProvider in its Android.mk).
The actual way of adding JAR dependency varies depending on what do you use for building your app (e.g. Ant, Maven, Gradle, or Eclipse).

Categories

Resources