Back

Hello

  • 0
  • Self Hosted
  • Android
D5
20 May, 2024, 12:35

Nope

TL;DR
Developers had trouble with an Android app's AndroidManifest.xml. The issue was with manifest permissions for internet access. The solution was to add the necessary <uses-permission> tags outside the <application> tag in AndroidManifest.xml. They also needed to set the endpoint in appwriteConfig to their PC's local IP address instead of localhost to resolve a [AppwriteException: Network request failed] error on the Android emulator. Make sure to configure this setting correctly for self-hosting Appwrite.
D5
20 May, 2024, 12:35

Your android app

ramzor
20 May, 2024, 12:35

😄

D5
20 May, 2024, 12:36

You have a file called AndroidManifest.xml

ramzor
20 May, 2024, 12:37

I really cant find it 😄

ramzor
20 May, 2024, 12:37

in node modules ?

ramzor
20 May, 2024, 12:37

I found it there

D5
20 May, 2024, 12:37

So inside the file you add the 2 flags:

TypeScript
<manifest xlmns:android...>
 ...
 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 <application ...
</manifest>```
D5
20 May, 2024, 12:38

You're developing android with Kotlin or Java?

ramzor
20 May, 2024, 12:38

Java

ramzor
20 May, 2024, 12:38
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
TypeScript
<uses-permission android:name="android.permission.INTERNET" />

<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
    android:launchMode="singleTask"
    android:windowSoftInputMode="adjustResize"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
</application>
</manifest>
ramzor
20 May, 2024, 12:39

this is the correct file?

D5
20 May, 2024, 12:39

Is it called AndroidManifest.xml?

D5
20 May, 2024, 12:39

Seems yes, that's it

ramzor
20 May, 2024, 12:39

yes

D5
20 May, 2024, 12:39

That's correct. Add the other tag bellow

D5
20 May, 2024, 12:40

Specifically:

TypeScript
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
ramzor
20 May, 2024, 12:40
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
TypeScript
<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCWSS_NETWORK_STATE" />
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
    android:launchMode="singleTask"
    android:windowSoftInputMode="adjustResize"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
</application>
</manifest>
ramzor
20 May, 2024, 12:41

i added them within the application

ramzor
20 May, 2024, 12:41

right?

D5
20 May, 2024, 12:41

Nope, should be outside

ramzor
20 May, 2024, 12:42
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCWSS_NETWORK_STATE" />
TypeScript
<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
    android:launchMode="singleTask"
    android:windowSoftInputMode="adjustResize"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
</application>
</manifest>
D5
20 May, 2024, 12:42

That's correct

ramzor
20 May, 2024, 12:43

meh, im still getting the error. I have to go now unfortunately but thanks for your time i will try some other way

D5
20 May, 2024, 12:55

You will need to sync gradle and reinstall the app

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more