Alejandro H
Alejandro H

Reputation: 412

Android Studio 3.0.1 unknown element <user-permission> found

Ok, I was making a project that will use my localhost to test out a username and password from an app. I am getting an error message for AndroidManifest.xml. It says:

error: unknown element [user-permission] found. unknown element [user-permission] found.

Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:Execution failed for task ':app:processDebugResources'. Failed to execute aapt

What could possibly be the problem?

Here is AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=... >

<uses-sdk
    ... />

<user-permission android:name="android.permission.INTERNET" />

<application
    ... >
    <activity android:name="com.example.application.mysqldemo.MainActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <meta-data
        ... />
    <meta-data
        ... />

    <provider
        ... />
</application>

</manifest>

Also, I am using Xampp as my localhost and also I am using port 8080, instead of port 80 due to firewall issue on apache. So, will I be able to access a file like this?:

String login_url = "http://10.0.2.2:8080/login.php"; 

Upvotes: 3

Views: 6064

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006594

<user-permission android:name="android.permission.INTERNET" />

There is no such element. Most likely, you want <uses-permission>:

<uses-permission android:name="android.permission.INTERNET" />

So, will I be able to access a file like this?: localhost:8080/login.php

No, assuming that localhost is your development machine. Your development machine is not your Android device, nor is it your Android emulator. For a device, or for an emulator running on some other computer, you will need the actual IP address of your development machine. If you are using the Android emulator on the same machine as this Web server, replace localhost with 10.0.2.2, as is covered in the documentation.

Upvotes: 10

Related Questions