Android Studio Errors persist - android

When I insert this in AndroidManifest.xml:
<uses­permission android:name="android.permission.RECORD_AUDIO"/> <uses­permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
Then I get these errors:
*Error:Element type "uses" must be followed by either attribute specifications, ">" or "/>".
Error:Cannot read packageName from /Users/Money/AndroidStudioProjects/LiFi2/app/src/main/AndroidManifest.xml*
Why?
I tried to put it all kinds of places in this code, but keep getting the same error.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dk.li_fi.lifi2">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
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>
</application>
<uses­permission android:name="android.permission.RECORD_AUDIO"/>
<uses­permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
</manifest>

The element name is <uses-permission>, not <usespermission>.

Place this before the application tag.
<uses­-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

Related

Places API Not Working

I am trying to use the Google Places API. However, I am always getting errors.
Here is my AndroidManifest.xml
<?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.example.mapthingie">
<uses-permission android:name="android.permission.INTERNET" />
<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" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaKEY" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:icon">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaAPIKEY" />
<activityhttps://stackoverflow.com/tags
android:name=".SettingsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
In my LogCat, I am getting this error:
PLACES_API_KEY_INVALID
though, as you can see, I am using a valid key. How can I fix this?
I see there are two different keys in Manfiest.xml
try to remove the one inside the application tag.
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaAPIKEY" />
Here is the edited one, copy and paste and try.
If it din't work, renew your API_Key and then replace it .
<?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.example.mapthingie">
<uses-permission android:name="android.permission.INTERNET" />
<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" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaKEY" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:icon">
<activity
android:name=".SettingsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
cheers!

Getting error when trying to generate signed APK

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

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 .

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.

AndroidManifest.xml The markup in the document following the root element must be well formed

I have got Eclipse to generate a Basic android Hello World app, But it has 2 errors: first, in my AndroidManifest.xml on these two lines:
I get The markup in the document following the root element must be well formed, Also My R.java Will not generate, no matter how many times I clean my project. Any Answers?
the manifest is here: http://jsfiddle.net/NHDU6/
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jfkingsley.maclogin"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
<!--
Declare the contents of this Android application. The namespace
attribute brings in the Android platform namespace, and the package
supplies a unique name for the application. When writing your
own application, the package name must be changed from "com.example.*"
to come from a domain that you own or have control over.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jfkingsley.maclogin" >
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
<application
android:icon="#drawable/ic_launcher_home"
android:label="#string/home_title" >
<activity
android:name="Home"
android:launchMode="singleInstance"
android:stateNotNeeded="true"
android:theme="#style/Theme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="Wallpaper"
android:icon="#drawable/bg_android_icon"
android:label="Wallpaper" >
<intent-filter>
<action android:name="android.intent.action.SET_WALLPAPER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Thanks, Jonathan
Here is your manifest,
You should not specify more than one Manifest and You should not specify more than one <application> tags.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jfkingsley.maclogin" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
<application
android:icon="#drawable/ic_launcher"
android:label="h" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="Home"
android:launchMode="singleInstance"
android:stateNotNeeded="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="Wallpaper"
android:icon="#drawable/ic_launcher"
android:label="Wallpaper" >
<intent-filter>
<action android:name="android.intent.action.SET_WALLPAPER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
It may be that you are missing something, but sometimes doing a simple re-format of code: CTRL+SHIFT+F, clears the problem.
I looked at your manifest file. The error is caused because you have 2 declarations of <manifest /> tag.
It begins with:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jfkingsley.maclogin"
android:versionCode="1"
android:versionName="1.0" >
Then some comments follow and another declaration starts:
<!--
Declare the contents of this Android application. The namespace
attribute brings in the Android platform namespace, and the package
supplies a unique name for the application. When writing your
own application, the package name must be changed from "com.example.*"
to come from a domain that you own or have control over.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jfkingsley.maclogin" >
<uses-permission android:name="android.permission.CALL_PHONE" />
Your either forgot to comment one of the manifests tag, confused something, or following a wrong tutorial. The AndroidManifest file should have only one <manifest /> tag
The Auto-generated AndroidManifest.xml file has some problem by itself. There is two manifest tag and two uses-sdk tag inside it. That is the problem. Do as follows:
1- Delete the closing tag of first manifest tag which is:
</manifest>
2- Delete definition tag of the second manifest tag which is:
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="net.learn2develop.fragments"
android:versionCode="1"
android:versionName="1.0" >
3- If there is two uses-sdk tag, also delete the second uses-sdk tag.
I added a new activity to my app, and it gave this error after. The manifest disappeared from android-studio completely.
I had to edit the manifest with a text editor. It seems that when I added a new activity, Android Studio created a new tag then added the new activity tag inside in the manifest file, rather than just adding the tag with the new activity in the manifest.
After you update the manifest, the project worked fine.
<?xml version="1.0" encoding="utf-8"?>
< xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.groofy">
<activity
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"/>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main"
android:theme="#style/AppTheme.NoActionBar"/>
<activity
android:name=".SignUp"
android:label="#string/title_activity_sign_up"
android:theme="#style/AppTheme.NoActionBar"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
/> should not be at the end of the file I had the same issue the error means the xml file is not correctly formatted you should try removing the / in front of the > or simply reformat

Categories

Resources