educative.io

Сan't get the data

I get an error when trying to upload data, help pls

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>

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

<application
    android:allowBackup="true"
    android:dataExtractionRules="@xml/data_extraction_rules"
    android:fullBackupContent="@xml/backup_rules"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:targetApi="31">
    <activity
        android:name=".LoginActivity"
        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=".MainActivity" />
    <activity android:name=".BlogDetailsActivity" />
</application>

build.gradle
plugins {
id ‘com.android.application’
id ‘org.jetbrains.kotlin.android’
}

android {
namespace ‘com.vyuzzzh.travelblog’
compileSdk 33

defaultConfig {
    applicationId "com.vyuzzzh.travelblog"
    minSdk 21
    targetSdk 33
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}
buildFeatures {
    viewBinding true
}

}

dependencies {

// kotlin
implementation 'androidx.core:core-ktx:1.8.0'

// http
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.google.code.gson:gson:2.10.1'

// ui
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.github.bumptech.glide:glide:4.15.1'

// tests
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

}

Logcat:
---------------------------- PROCESS STARTED (23139) for package com.vyuzzzh.travelblog ----------------------------
2023-06-11 13:31:44.507 23139-23139 System pid-23139 W ClassLoader referenced unknown path: /data/app/com.vyuzzzh.travelblog-1/lib/arm64
2023-06-11 13:31:44.516 23139-23139 AppCompatDelegate com.vyuzzzh.travelblog D Checking for metadata for AppLocalesMetadataHolderService : Service not found
2023-06-11 13:31:44.518 23139-23139 art com.vyuzzzh.travelblog W Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
2023-06-11 13:31:44.519 11010-11416 ActivityManager system_process I START u0 {cmp=com.vyuzzzh.travelblog/.MainActivity} from uid 10064 on display 0
2023-06-11 13:31:44.521 11576-11764 EGL_emulation com.android.launcher3 D eglMakeCurrent: 0x78593ba2c0: ver 3 0 (tinfo 0x78595d3140)
2023-06-11 13:31:44.522 11576-11764 Surface com.android.launcher3 E getSlotFromBufferLocked: unknown buffer: 0x784bd1b8c0
2023-06-11 13:31:44.533 11010-12294 ActivityManager system_process I START u0 {cmp=com.vyuzzzh.travelblog/.BlogDetailsActivity} from uid 10064 on display 0
2023-06-11 13:31:44.536 889-1055 SurfaceFlinger pid-889 E ro.sf.lcd_density must be defined as a build property
2023-06-11 13:31:44.537 23139-23153 OpenGLRenderer com.vyuzzzh.travelblog D Use EGL_SWAP_BEHAVIOR_PRESERVED: true
2023-06-11 13:31:44.540 23139-23139 com.vyuzzzh.travelblog D HostConnection::get() New Host Connection established 0x7855b062c0, tid 23139
2023-06-11 13:31:44.591 23139-23153 com.vyuzzzh.travelblog D HostConnection::get() New Host Connection established 0x78593b0360, tid 23153
2023-06-11 13:31:44.591 23139-23153 OpenGLRenderer com.vyuzzzh.travelblog I Initialized EGL, version 1.4
2023-06-11 13:31:44.591 23139-23153 OpenGLRenderer com.vyuzzzh.travelblog W Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without…
2023-06-11 13:31:44.592 23139-23153 EGL_emulation com.vyuzzzh.travelblog D eglCreateContext: 0x78593b98c0: maj 3 min 0 rcv 3
2023-06-11 13:31:44.595 23139-23153 EGL_emulation com.vyuzzzh.travelblog D eglMakeCurrent: 0x78593b98c0: ver 3 0 (tinfo 0x7855c8e980)
2023-06-11 13:31:44.595 23139-23153 eglCodecCommon com.vyuzzzh.travelblog E glUtilsParamSize: unknow param 0x00008cdf
2023-06-11 13:31:44.595 23139-23153 eglCodecCommon com.vyuzzzh.travelblog E glUtilsParamSize: unknow param 0x00008824
2023-06-11 13:31:44.598 23139-23153 EGL_emulation com.vyuzzzh.travelblog D eglMakeCurrent: 0x78593b98c0: ver 3 0 (tinfo 0x7855c8e980)
2023-06-11 13:31:44.643 11010-11151 ActivityManager system_process I Displayed com.vyuzzzh.travelblog/.BlogDetailsActivity: +101ms (total +13s749ms)
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53557): avc: denied { getattr } for path="/proc/1" dev=“proc” ino=1036 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:init:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53558): avc: denied { search } for name=“1” dev=“proc” ino=1036 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:init:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53559): avc: denied { search } for name=“1” dev=“proc” ino=1036 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:init:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53560): avc: denied { getattr } for path="/proc/2" dev=“proc” ino=2269 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53561): avc: denied { search } for name=“2” dev=“proc” ino=2269 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53562): avc: denied { search } for name=“2” dev=“proc” ino=2269 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53563): avc: denied { getattr } for path="/proc/3" dev=“proc” ino=2270 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53564): avc: denied { search } for name=“3” dev=“proc” ino=2270 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53565): avc: denied { search } for name=“3” dev=“proc” ino=2270 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53566): avc: denied { getattr } for path="/proc/5" dev=“proc” ino=2272 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53567): avc: denied { search } for name=“5” dev=“proc” ino=2272 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53568): avc: denied { search } for name=“5” dev=“proc” ino=2272 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53569): avc: denied { getattr } for path="/proc/7" dev=“proc” ino=2274 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53570): avc: denied { search } for name=“7” dev=“proc” ino=2274 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53571): avc: denied { search } for name=“7” dev=“proc” ino=2274 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53572): avc: denied { getattr } for path="/proc/8" dev=“proc” ino=2275 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53573): avc: denied { search } for name=“8” dev=“proc” ino=2275 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53574): avc: denied { search } for name=“8” dev=“proc” ino=2275 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53575): avc: denied { getattr } for path="/proc/9" dev=“proc” ino=2276 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:31:44.670 23161-23161 ps pid-23161 W type=1400 audit(0.0:53576): avc: denied { search } for name=“9” dev=“proc” ino=2276 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
2023-06-11 13:32:00.057 889-980 hwcomposer pid-889 D hw_composer sent 85 syncs in 60s
2023-06-11 13:32:14.375 31742-32538 NetworkScheduler.Stats com.google.android.gms.persistent I Task com.google.android.gms/com.google.android.gms.icing.service.IcingGcmTaskService started execution. cause:4 exec_start_elapsed_seconds: 493361 [CONTEXT service_id=218 ]
2023-06-11 13:32:14.378 31742-5340 NetworkScheduler.Stats com.google.android.gms.persistent I Task com.google.android.gms/com.google.android.gms.icing.service.IcingGcmTaskService finished executing. cause:4 result: 1 elapsed_millis: 11 uptime_millis: 11 exec_start_elapsed_seconds: 493361 [CONTEXT service_id=218 ]
2023-06-11 13:32:14.389 31742-32538 NetworkScheduler.Stats com.google.android.gms.persistent I Task com.google.android.gms/com.google.android.gms.ipa.base.IpaGcmTaskService started execution. cause:5 exec_start_elapsed_seconds: 493361 [CONTEXT service_id=218 ]
2023-06-11 13:32:14.390 31742-32538 NetworkScheduler.Stats com.google.android.gms.persistent I Task com.google.android.gms/com.google.android.gms.ipa.base.IpaGcmTaskService finished executing. cause:5 result: 1 elapsed_millis: 7 uptime_millis: 7 exec_start_elapsed_seconds: 493361 [CONTEXT service_id=218 ]
2023-06-11 13:32:24.636 23139-23154 BlogHttpClient com.vyuzzzh.travelblog E Error loading blog articles
2023-06-11 13:33:00.053 889-980 hwcomposer pid-889 D hw_composer sent 4 syncs in 60s
2023-06-11 13:34:00.076 889-980 hwcomposer pid-889 D hw_composer sent 3 syncs in 60s

Hi @Mikhail_Vyuzhanin !!
To resolve this issue, please consider the following steps:

  1. Verify that you have the correct internet permission in your AndroidManifest.xml file. The android.permission.INTERNET permission is required to access the internet. Make sure it is included in your manifest file within the <uses-permission> tag.
  2. Double-check the syntax and placement of the <uses-permission> tag in your AndroidManifest.xml file. It should be placed directly under the <manifest> tag, outside of any other tags.
  3. Ensure that you haven’t accidentally modified or added any custom attributes like android:dataExtractionRules to the <application> tag or any other invalid attribute that might be causing the issue. Remove any unrecognized or unnecessary attributes to avoid conflicts.
  4. If you have recently made changes to your AndroidManifest.xml file, clean and rebuild your project to ensure the changes are properly applied.
  5. Test your app on a physical device or a reliable emulator with an active internet connection to rule out any connectivity issues.

If the problem persists after following these steps, please provide more details about the error message or any additional log information to help further diagnose the issue.

As it turned out, this did not work in the pixel 6 pro api 23 emulator.
Changing the emulator solved the problem, it also works correctly on the device.


Course: Modern Android App Development with Kotlin - Learn Interactively
Lesson: Loading Data From the Internet - Modern Android App Development with Kotlin

1 Like