Search code examples
androidimagelayoutpreviewaide

Having trouble with viewing a layout in AIDE


I'm making an app in AIDE (It's like an android studio but for Android) and I'm struggling to add images to it. Every time I add an image (an src for the image to be exact), I don't have any preview and it tells me this:

"Can not view the layout. Attempt to invoke interface 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference"

I searched for a while but if I'm doing something wrong but even though I copied the exact code, there is still no luck in the preview but there is no error in the code at all. It still runs and I can see the image when I open the app itself.

This is the code in my xml file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="#9F0900"
    android:gravity="center">

    <ImageView
        android:layout_height="80dp"
        android:layout_width="80dp"
        android:src="@drawable/ic_launcher"/>

    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</LinearLayout>

And I don't know if this can help but I'll also show you the java file for the xml

package com.luminetech.metaspecs;

import android.content.*;
import android.app.*;
import android.os.*;

public class SplashScreen extends Activity 
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splashscreen);
        
        Thread th = new Thread()
        {
            public void run()
            {
                try
                {
                    sleep(3000);
                    Intent in = new Intent (getApplicationContext(), MainActivity.class);
                    startActivity(in);
                    finish();
                }
                catch (Exception e){}
            }
        };
        th.start();
    }
}

Solution

  • You need to roll back your android device to android version 10 and no higher. Since android studio for android devices does not support viewing on later versions of android.