错误:在android studio中查找属性“ro.serialno”时拒绝访问

ztigrdn8  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(988)

我在android studio中编写了一个java代码,可以通过点击按钮从互联网下载并显示图像。它显示错误
e/libc:拒绝访问查找属性“ro.serialno”

当前dex文件中有多个类。如果未对该类应用任何转换,则在此类上调用ReTransformClass可能会失败!
日志:

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

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题