我在Android Studio中写了一段java代码,在点击按钮时从网上下载并显示图片。它显示了错误
E/libc。查找属性 "ro.serialno "的访问被拒绝
当前的dex文件中有一个以上的类。如果没有转换应用到这个类上,在这个类上调用RetransformClasses可能会失败!
The log:
E/libc: Access denied finding property "ro.serialno"**
W/wnloadingimages: type=1400 audit(0.0:36): avc: denied { read } for name="u:object_r:serialno_prop:s0" dev="tmpfs" ino=7213 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:serialno_prop:s0 tclass=file permissive=0
V/StudioTransport: Agent command stream started.
V/StudioTransport: JNIEnv not attached
V/StudioProfiler: Memory control stream started.
V/StudioProfiler: Transformed class: android/os/PowerManager
Transformed class: android/app/IntentService
Transformed class: android/app/AlarmManager$ListenerWrapper
V/StudioProfiler: Transformed class: android/os/PowerManager$WakeLock
V/StudioProfiler: Transformed class: android/app/Instrumentation
V/StudioProfiler: Transformed class: android/location/LocationManager$ListenerTransport
Transformed class: android/app/JobSchedulerImpl
V/StudioProfiler: Transformed class: android/app/job/JobServiceEngine$JobHandler
V/StudioProfiler: Transformed class: android/app/ActivityThread
V/StudioProfiler: Transformed class: android/os/Debug
V/StudioProfiler: Transformed class: android/app/AlarmManager
Transformed class: android/app/job/JobService
V/StudioProfiler: Transformed class: android/app/PendingIntent
V/StudioProfiler: Transformed class: android/location/LocationManager
V/StudioProfiler: Transformed class: java/net/URL
**W/zygote: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
My entire code:
package com.example.downloadingimages;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class MainActivity extends AppCompatActivity {
ImageView image1;
public void downloadImage(View view) {
Log.i("Info", "Button Tapped");
imageDownloader task = new imageDownloader();
Bitmap myImage;
try {
myImage = task.execute("https://th.bing.com/th/id/OIP.Djjwf_HTzjvMpkRpHdfpwwHaJ7?w=200&h=269&c=7&o=5&dpr=1.5&pid=1.7").get();
image1.setImageBitmap(myImage);
} catch (Exception e) {
e.printStackTrace();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image1 = findViewById(R.id.imageView);
public class imageDownloader extends AsyncTask<String, Void, Bitmap> {
@Override
protected Bitmap doInBackground(String... urls) {
try {
URL url = new URL(urls[0]);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
InputStream in = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(in);
return myBitmap;
} catch (Exception e) {
e.printStackTrace();
return null;