【问题标题】:Unable to resolve Host for android App why?为什么无法解析 Android 应用程序的主机?
【发布时间】:2021-02-18 20:59:41
【问题描述】:

我在 MYSQL 中开发了一个带有后端的 android 本机应用程序。虽然有一个正确的互联网连接,但我遇到了一个问题,即当我尝试登录应用程序时,我收到了一个错误消息,显示为“Volley connection Error: Unable to resolve host of my hosting server in the phone which is in above API 27 版本。但它可以在没有提到的问题的情况下运行到 API 27 版本的安卓手机。 为什么我会遇到这个问题??

apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.0"

    defaultConfig {
        applicationId "com.example.MySQL"
        minSdkVersion 19
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        useLibrary 'org.apache.http.legacy'

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.cardview:cardview:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.intuit.sdp:sdp-android:1.0.6'
    implementation 'com.intuit.ssp:ssp-android:1.0.6'

    //noinspection GradleCompatible
    implementation'com.android.support:design:28.0.0'
    implementation'com.android.volley:volley:1.1.1'
    implementation'com.rengwuxian.materialedittext:library:2.1.4'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
  //  compile 'com.github.bumptech.glide:glide:4.2.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.squareup.picasso:picasso:2.71828'

    compile('com.github.bumptech.glide:glide:4.4.0@aar') {
        transitive = true;
    }

  


}

【问题讨论】:

    标签: android mysql android-studio hosting web-hosting


    【解决方案1】:

    将此代码添加到android清单文件的应用程序标签中。

    <application
        android:usesCleartextTraffic="true" 
        >
    
    </application>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-06
      • 1970-01-01
      • 1970-01-01
      • 2019-06-02
      • 1970-01-01
      • 2016-12-24
      • 1970-01-01
      • 2013-06-20
      相关资源
      最近更新 更多