错误:访问被拒绝在 Android Studio 中找到属性“ro.serialno”

问题描述

我在 Android Studio 中编写了一个 Java 代码,通过单击按钮从 Internet 下载和显示图像。显示错误

E/libc:访问被拒绝,发现属性“ro.serialno”

当前的 dex 文件中包含多个类。如果未对其应用任何转换,则对该类调用 RetransformClasses 可能会失败!

日志:

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!

我的整个代码

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;
            }
        }
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)