-1

Hello i am using this emulator created for M1 machines https://github.com/google/android-emulator-m1-preview . i am getting the poster path from the moviesApi.however in other devices they paint well in the recyclerview and when i emulate it in my moto g6 this problem also happens.

enter image description here

The images displayed are the ones set in the xml as follows.

  <ImageView
                android:id="@+id/rv_image_movie"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                android:background="@drawable/movies_noimage"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">

            </ImageView>

The retrofit response is perfect and as i commented it works in other emulator api 26 27 28 any you name it. But in this one and in motog6 doesnt work something must be wrong.

This is the end result!

This is weird because in the m1 supported emulator my rick and morty app shows images perfectly.

enter image description here

kirara
  • 37
  • 3

1 Answers1

-1

Ok i found the answer to this and it might help lots of people. To fix this issue you need to add in your android manifest...

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

<application
    android:name=".MovieApp"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:usesCleartextTraffic="true"

    android:theme="@style/Theme.MoviesDBKotlin">
    <activity
        android:name=".ui.MainActivity"
        android:label="@string/app_name"
        android:theme="@style/Theme.MoviesDBKotlin">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

add android:usesCleartextTraffic="true" will fix the emulator problem something to do with glide in my case i think so . Enjoy!!.

kirara
  • 37
  • 3
  • The problem is no with the glide! It's because you're trying to load images from a non-HTTPS link. Use the HTTPS version and the problem will be fixed. By default, loading resources from an HTTP version is restricted. – OMi Shah Jan 17 '21 at 05:46
  • in the newer apis from 9 and onwards (maybe from 8+) you have to use HTTPS otherwise your network call will be blocked. – himel Jan 17 '21 at 07:23
  • wow nice both of you are right anyways i think we helped other people with this post . and thank you for responce – kirara Jan 17 '21 at 17:59