Getting error when trying to generate signed APK - android

I am trying to generate a signed APK for my app, however, i am getting two of the below error messages. Please see my Android Manifesto file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.elderlywatch.elderlywatch">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BODY_SENSORS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:name=".FallDetectorSettings.SettingValues"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat">
<activity
android:name=".HomeActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:taskAffinity="">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".HRDetailsActivity"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".HomeActivity" />
</activity>
<activity android:name=".UserActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".FallDetectHomeActivity"
android:icon="#mipmap/ic_launcher"
android:screenOrientation="portrait" />
<activity
android:name=".ContactDetailsActivity"
android:icon="#mipmap/ic_launcher"
android:screenOrientation="portrait" />
<activity
android:name=".FallDetectSettingActivity"
android:icon="#mipmap/ic_launcher"
android:screenOrientation="portrait"/>
<activity
android:name=".MonitoringFallActivity"
android:icon="#mipmap/ic_launcher"
android:screenOrientation="portrait" />
<activity
android:name=".SMSSendActivity"
android:screenOrientation="portrait" />
<service android:name=".FallDetectorAccelerometer.DetectingFalls" >
</service>
<activity
android:name=".SMSDetailsActivity"
android:icon="#mipmap/ic_launcher"
android:screenOrientation="portrait"></activity>
</application>
</manifest>
I am getting the below two error messages and please can someone help me as I am struggling to generate a singed APK. I am able to build my app, however, when trying to create a API I always get the two error messages indicated below.
Error:Execution failed for task
':mobile:transformClassesWithDexForRelease'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.dex.DexIndexOverflowException: method ID not in [0,
0xffff]: 65536

The error:
\AndroidManifest.xml Error:(48) Error: The element must be a direct
child of the root element [WrongManifestParent] Error:Execution failed
for task ':mobile:lintVitalRelease'.
This indicates that you need to look at line 48 of your manifest.xml
That line looks like:
<application
android:name=".ApplicationState"
android:label="#string/app_name" />
That's a second xml <application> tag.
It tells you that tag must be a direct child of the root.
Probably just remove it and it will work.

Remove this
<application
android:name=".ApplicationState"
android:label="#string/app_name" />
and add this
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
**android:name=".ApplicationState"**
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:name=".FallDetectorSettings.SettingValues"
android:label="#string/app_name"
android:screenOrientation="portrait"
in your gradle (app) inside android{} place this
lintOptions {
checkReleaseBuilds false
}
for dex error follow the solution given by android in the below link:
https://developer.android.com/studio/build/multidex.html

Related

Contradictory error when using MobileAds in an Android app

I am somewhat confused by an error showing up in an Android app, where I want to use MobileAds.
Here is the Kotlin code:
val adRequest = AdRequest.Builder().build()
adView.loadAd(adRequest)
The AndroidManifest.xml file contains these three lines:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
And these are the errors I get:
Missing permissions required by BaseAdView.loadAd: android.permission.INTERNET
Missing permissions required by FusedLocationProviderClient.getLastLocation: android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION
Is there anyone out there who has an idea of what is going on?
Any relevant tip or explanation would be more than welcome.
Just in case this is the complete AndroidManifest.xml 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="me.soft.app">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:dataExtractionRules="#xml/data_extraction_rules"
android:fullBackupContent="#xml/backup_rules"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.App"
tools:targetApi="31">
<activity
android:name=".WorldExposureActivity"
android:exported="false"
android:parentActivityName=".ShopDetailActivity"
android:screenOrientation="portrait" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="XXXXXXX" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-1234567890012345~1234567890"/>
<activity
android:name=".ShopMapActivity"
android:exported="false"
android:label="#string/title_activity_shop_map"
android:parentActivityName=".MainActivity" />
<activity
android:name=".ShopDetailActivity"
android:exported="false"
android:parentActivityName=".MainActivity"
android:screenOrientation="portrait" />
<activity
android:name=".MainActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Uses permission is not working in built apk

When built my application, the built apk is not working any other devices. It is only working in my mobile. The error message i founded is user permission is not available and security exception. It is only working in my phone.
Here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dineshkumar.panicbutton">
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<application
android:allowBackup="true"
android:icon="#drawable/welcome"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:exported="true"
android:theme="#style/AppTheme">
<activity
android:name=".Welcome"
android:label="Panic Button"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
</activity>
<activity android:name=".Emergency" />
<activity android:name=".Contacts" />
<activity android:name=".ManualCadd" />
<activity android:name=".Message" />
<activity android:name=".Guide" />
<activity android:name=".Updatecontacts" />
<activity android:name=".ShowContacts" />
</application>
Your device should have Android 6.0 version or above to handle Runtime Permissions. Also you need to set the Target SDK version to 23 or above for listing dangerous permissions.

Getting MALFORMED error in android

This is my manifest file and I don't know why am I getting this error . Please help me out with this error. Everything is working fine, but the problem is the meta tags inside the applciation tags, if I write them outside the application tags then it crashes the app, and if I write them inside the application tags then I get the error "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED".
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nadeemahmad.guitest">
<!--Permissions-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<permission android:name="com.example.nadeemahmad.guitest.MAPS.RECIEVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.example.nadeemahmad.guitest.MAPS.RECIEVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permissions.READ_GSERVICES"/>
<uses-feature android:glEsVersion="0x0020000" android:required="true"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".splash"
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=".MainActivity"
android:noHistory="true" />
<activity
android:name=".profile"
android:noHistory="true" />
<activity
android:name=".profile_update"
android:noHistory="true" />
<activity
android:name=".sync_contacts"
android:noHistory="true" />
<activity
android:name=".settings"
android:noHistory="true" />
<activity android:name=".synced_contacts_list"></activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_android_map_api_key" />
<meta-data android:name="come.google.android.gms.version"/>
</application>
</manifest>
Rectify Your meta-data TAG . It should be com instead of come .
Wrong
<meta-data android:name="come.google.android.gms.version"/>
Perfect
<meta-data android:name="com.google.android.gms.version"/>
After that Clean-Rebuild and Run .

Android: GoogleMap v2 in a fragment requires the additional permissions

I'm trying to use GoogleMaps V2 within a fragment, but without success. In the emulator, I get the info, that I should update the play services. The same on the Samsung Galaxy Nexus. Once I updated the play services, I get the following error. All those permission - listed in the error - are part of my manifest file. Any idea?
Remark: I uploaded the demo project to Github. Feel free to use it. I'm using IntelliJ but the GoogleMap API is from a former Eclipse project.
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.demo.mymap/com.demo.mymap.MainActivity}:
android.view.InflateException: Binary XML file line #8: Error
inflating class fragment ... Caused by: android.view.InflateException:
Binary XML file line #8: Error inflating class fragment ... Caused by:
java.lang.SecurityException: The Maps API requires the additional
following permissions to be set in the AndroidManifest.xml to ensure a
correct behavior:
My manifest looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.demo.mymap" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<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" />
<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>
<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="AIzaSyA6mS6BJy89Sgkj1GCgRrusQ84p_T5hLEA" />
</application>
</manifest>
Move your <uses-permission> elements to be children of <manifest>, not children of <application>.
Take a look on what the Logcat says:
Caused by: java.lang.SecurityException: The Maps API requires the
additional following permissions to be set in the AndroidManifest.xml
to ensure a correct behavior:
Your permissions at your Manifest are declared wrong.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.demo.mymap" >
<application
android:allowBackup="true"
android:icon="#mipmap/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>
<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="AIzaSyA6mS6BJy89Sgkj1GCgRrusQ84p_T5hLEA" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<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" />
</manifest>
Your perrmissions must be defined outside the application definition, and must be children of <manifest>:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.demo.mymap" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<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" />
<application
android:allowBackup="true"
android:icon="#mipmap/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>
<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="AIzaSyA6mS6BJy89Sgkj1GCgRrusQ84p_T5hLEA" />
</application>
</manifest>
check the sample and the info of the official documentation:
AndroidManifest.xml

Uploading app - Error getting android:icon atribute

I'm having this problem when I try to upload my app to Google Play:
Failed to run aapt dump badging:
W/ResourceType(32467): No known package when getting value for resource number 0x01080051
ERROR getting 'android:icon' attribute: attribute is not a string value
I have been searching and I know this issue can be caused by the strings file. I found this page but I can't follow the second part because in the first step, I don't get the "type" and the "entry"...
I don't know what should I do... Thanks for help!!
My manifest:
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo">
<activity
android:name="com.extremeye.MainActivity"
android:label="#string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.extremeye.VisualizadorActivity"
android:label="#string/title_visualizador"
android:screenOrientation="landscape"
android:icon="#drawable/void_icon"
android:configChanges="orientation|keyboardHidden|screenSize">
</activity>
<activity
android:name="com.extremeye.SeleccionActivity"
android:icon="#android:drawable/ic_menu_set_as"
android:label="#string/title_seleccion"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize" >
</activity>
<activity
android:name="com.extremeye.InfoActivity"
android:label="#string/title_info"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize" >
</activity>
</application>
Turns out that the app icon in my manifest: android:icon="#drawable/app_icon" had corresponding files under /res/drawable-small, /res/drawable-normal, /res/drawable-large and /res/drawable-xlarge but not under /res/drawable. Looks like the automated process of Google Play only looks up /res/drawable. Copying the app icon into this directory.

Categories

Resources