Android app does not access API on the latest SDK(28) - Android Studio

Asked

Viewed 254 times

1

Good morning, I developed an app using android studio that does not access web service in a version of the android SDK, more specifically the SDK 28. I already declared on android manifest the target SDK:

<uses-sdk android:minSdkVersion="15"
    android:targetSdkVersion="28"
    android:maxSdkVersion="28" />

and also at Gradle:

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.companyname.myapp"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1.0
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

does anyone know how to solve this problem? I have already searched for information directly in the official documentation (https://developer.android.com/about/versions/pie/android-9.0-changes-28?hl=pt-BR), but I haven’t found anything to solve the problem. Thanks in advance to those who can help.

Note: the class I use for web service consumption is Httpurlconnection.

  • your link is at http or https?

  • Opa @Murillocomino, thanks for responding, the links I use are HTTP.

1 answer

2


Try to do the following, inside your Manifest in add application:

android:usesCleartextTraffic="true"

This allows all HTTP requests

  • look thank you very much, solved the problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.