Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 3.0.1 unknown element <user-permission> found

Tags:

android

xml

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"; 
like image 924
Alejandro H Avatar asked May 24 '26 21:05

Alejandro H


1 Answers

<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.

like image 111
CommonsWare Avatar answered May 26 '26 12:05

CommonsWare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!