Reza Zakeri
Reza Zakeri

Reputation: 1

My app cannot connect to the internet after migration to androidX

My app stops connecting to the internet after migration to the AndroidX. I didn't receive any error just cannot connect to the internet. I believe it could be due to some of the dependency's implementation. I have a large list of implementation as follow (the problem probably is in the the wordpress part);

    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.vectordrawable:vectordrawable:1.0.0'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'
    implementation project(path: ':library')
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
    implementation 'org.greenrobot:eventbus:3.1.1'
    
// for language selector
    implementation 'devlight.io:navigationtabbar:1.2.5'
    implementation 'com.github.mirrajabi:search-dialog:1.2.3'
    implementation 'com.github.shts:TriangleLabelView:1.1.2'
    implementation 'me.wangyuwei:ParticleView:1.0.4'
    implementation 'com.kyleduo.switchbutton:library:2.0.0'
    compile 'com.sackcentury:shinebutton:0.2.0'
/// wordpress
    implementation 'com.lsjwzh:materialloadingprogressbar:0.5.5-RELEASE'
    implementation 'com.marshalchen.ultimaterecyclerview:library:0.3.17'
    implementation 'com.mikepenz:iconics-core:1.7.9@aar'
    implementation 'com.mikepenz:google-material-typeface:1.2.0.1@aar'
    implementation 'com.mikepenz:community-material-typeface:1.2.64.1@aar'
    implementation('com.mikepenz:materialdrawer:4.4.4@aar') { transitive = true }
    implementation 'com.github.iammert:MaterialIntroView:1.6.0'
    implementation 'com.github.ksoichiro:android-observablescrollview:1.6.0'
    implementation 'com.google.android.gms:play-services-ads:20.2.0'
    implementation 'net.i2p.android.ext:floatingactionbutton:1.10.0'
    implementation 'com.makeramen:roundedimageview:2.2.1'
    implementation 'com.cleveroad:fan-layout-manager:1.0.4'
    implementation('com.afollestad.material-dialogs:core:0.9.0.2') { transitive = true }
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'com.github.mrengineer13:snackbar:1.2.0'
    implementation 'com.github.f0ris.sweetalert:library:1.5.6'
    implementation files('libs/slideme_inappsdk_v1.6_22Sept2015.jar')
    implementation 'com.sothree.slidinguppanel:library:3.3.1'
    implementation 'com.gjiazhe:MultiChoicesCircleButton:1.0'
    implementation files('libs/AndroidViewAnimations-1.1.3.jar')
    implementation 'io.github.kexanie.library:MathView:0.0.6'

    implementation 'com.android.volley:volley:1.2.0'
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation 'io.github.inflationx:calligraphy3:3.1.1'
    implementation 'io.github.inflationx:viewpump:2.0.3'

// Enabling multidex support.
    implementation 'androidx.multidex:multidex:2.0.1

'

Moreover, I have tried the internet connection permission in the manifest, but it didn't solve the problem! I would be grateful if someone can help me through this.

The manifest is as follow:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="***.***.***">

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


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:icon"
        android:usesCleartextTraffic="true">


        <activity
            android:name=".***.**.ActivityBrowser"
            android:label=""
            android:launchMode="singleTop"
            android:parentActivityName=".**.activities.ActivityHome"
            android:screenOrientation="portrait"
            android:exported="true">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="**.**.**.**.activities.ActivityHome" />
        </activity>
        <activity
            android:name=".***.***.ActivityArticlesByCategory"
            android:label=""
            android:launchMode="singleTop"
            android:parentActivityName=".***.activities.ActivityHome"
            android:screenOrientation="portrait"
            android:exported="true">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="***.***.***.***.activities.ActivityHome" />
        </activity>
        <activity
            android:name=".***.***.ActivityDetail"
            android:label=""
            android:launchMode="singleTop"
            android:parentActivityName=".***.***.ActivityHome"
            android:exported="true">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="***.***.***.***.activities.ActivityHome" />
        </activity>
        <activity
            android:name=".***.activities.ActivityComments"
            android:label="@string/comment"
            android:launchMode="singleTop"
            android:parentActivityName=".**.***.ActivityDetail"
            android:screenOrientation="portrait"
            android:exported="true">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="***.****.****.****.activities.ActivityDetail" />
        </activity>
        <activity
            android:name=".****.activities.ActivityHome"
            android:label=""
            android:launchMode="singleTop"
            android:screenOrientation="portrait"
            android:exported="true">
            <meta-data
                android:name="android.app.default_searchable"
                android:value=".activities.ActivitySearch" />
        </activity>
        <activity
            android:name=".***.***.ActivitySearch"
            android:label=""
            android:launchMode="singleTop"
            android:parentActivityName=".***.***.ActivityHome"
            android:screenOrientation="portrait"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
            </intent-filter>

            <!-- Parent activity meta-data to support 4.0 and lower -->
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="**.***.***.***.activities.ActivityHome" />
            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable" />
        </activity>
        <activity android:name=".splash"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".MainPage"
            android:exported="true"/>
        <activity
            android:name=".CatActivity"
            android:noHistory="true"
            android:exported="true"/>
        <activity android:name=".Blank_Activity"
            android:exported="true"/>
        <activity android:name=".***.MultiLanguage.LanguageActivity"
            android:exported="true"/>
        <activity android:name=".Settings"
            android:exported="true"/>
        <activity
            android:name=".Purchase_Activity"
            android:label="@string/title_activity_purchase_"
            android:parentActivityName=".MainPage"
            android:theme="@style/AppTheme"
            android:exported="true">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="**.***.***.MainPage" />
        </activity>
        <activity
            android:name=".***.**.***"
            android:label="@string/****"
            android:theme="@style/AppTheme"
            android:exported="true"
            />
    </application>

</manifest>

Upvotes: -1

Views: 326

Answers (1)

Ole Pannier
Ole Pannier

Reputation: 3683

No there is nothing to do in the implementations. Try to add this in your AndroidManifest.xml:

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

If it doesn't work, please add your AndroidManifest.xml to your question. Probably there something wrong. Also try to update your version in the other gradle folder called build.gradle(Project:)

Follow along this documentation and update your XML files. Could be your XML files aren't migrated to androidx, only your java files

Upvotes: 0

Related Questions