Reputation: 1043
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.
Upvotes: 15
Views: 2819
Reputation: 1048
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>
Upvotes: 0
Reputation: 3285
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.
Upvotes: 2
Reputation: 147
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
Upvotes: -1
Reputation: 2068
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
Upvotes: 1
Reputation: 10896
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"
Upvotes: 1
Reputation: 316
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.
Upvotes: 1
Reputation: 238
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
Upvotes: 2
Reputation: 1627
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
Upvotes: 3
Reputation: 5711
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"
Upvotes: 1
Reputation: 62189
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.
Upvotes: 1
Reputation: 4406
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 .
Upvotes: 1
Reputation: 1530
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 :)
Upvotes: 1