3

Getting Some Of Notes Regarding path_provider-1.5.1 and API not working which I integrated through http/dio in Release Build(working in debug mode) For Flutter.

Note: /home/webelightpc/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.5.1/android/src/main/java/io/flutter/plugins/pathprovider/PathProviderPlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.

ich

3 Answers 3

13

According to https://github.com/flutter/flutter/issues/27883

It's strange that without adding permission in AndroidManifest.xml it'll work in debug but in release modeany API request will not work, solutions is as simple as below...

just add permission like this

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

in your app's android/app/src/main/AndroidManifest.xml

Sign up to request clarification or add additional context in comments.

3 Comments

Correct answer, would be useful to mention where to place it within the manifest file. Just before the <application> block.
@cabbi i have added the full code below, please check
Why does API calling in debug mode work without adding this line and it doesn't work in release mode?
2

For those people who are new in flutter,here is the full demo. you have to add permission above "Application" tag

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.reprecinct.app.reprecinct">

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

   <application
        android:label="your app label"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

Comments

1

if you're using vscode, and you've added the necessary permission and still get socketException, then its vscode. go to run and debug section in vscode, untick all Exceptions. enter image description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.