Reputation: 61
I'm developing an Android app with Android studio.
I've been trying to set some permissions into my manifest file in order to write some file to the external storage everything following the tutorial: http://developer.android.com/training/basics/data-storage/files.html
Here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="timetracker.iuandroid"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18" />
<android:uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<android:uses-permission android:name="android.permission.READ_PHONE_STATE" />
<android:uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
..... and some more tags .....
The problem is that manifest is telling me that "android:name" is an unknow attribute, and if I remove it, of course, it tells me that a name attribute is needed, so I can't create a new file in my app because of this permission problem
Is there somethign I'm missing? or something deprecated not shown at the tutorial?
I can't post Images due to my low reputation sorry but the error goes throgh every android:name= and android:name= tags
Upvotes: 1
Views: 2834
Reputation: 5336
There seem to be multiple issues with your AndroidManifest
file. First, a Java
Package
is usually declared like the following:
com.domain.package
So your declaration should be com.iuandroid.timetracker
.
Secondly, the maxSdkVersion
in in the wrong spot. This...
android:maxSdkVersion="18" />
should be in the <uses-sdk/>
section, not between the permission tags. Your permissions are also declared incorrectly; it should be...
<uses-permission android:name="YOUR_PERMISSION"/>
instead of...
<android:uses-permission android:name="YOUR_PERMISSION"/>
Lastly, you are also missing a few closing tags. Your AndroidManifest.xml
file should be as follows when formatted correctly:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="timetracker.iuandroid"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18"
android:maxSdkVersion="18" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
Upvotes: 2