Home > Software design >  Android Studio project succesfully launching but nothing pops up - Android Java
Android Studio project succesfully launching but nothing pops up - Android Java

Time:01-10

I'm running:

package com.example.projectTest;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class WelcomePage extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome_page);
    }
}

with:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".WelcomePage">

</androidx.constraintlayout.widget.ConstraintLayout>

but I'm getting the following error in the logcat when I run:

Could not get package user id: run-as: unknown package: com.example.projectTest
Could not find apks for this package: com.example.projectTest
Could not get package user id: run-as: unknown package: com.example.projectTest
Could not find apks for this package: com.example.projectTest
Failed to measure fs-verity, errno 1: /data/app/~~kWSycfQmCvKbfYx2KzxrNA==/com.example.projectTest-x4Zc9BUq0kRGdN5aX5AxXQ==/base.apk

The launch succeeds, but no app shows up on the emulator (Pixel 6 API 32). What could be the problem? Thank you.

CodePudding user response:

There are a few potential issues that could be causing this problem. Here are some suggestions for troubleshooting:

  1. Make sure that you have the correct layout file set as the content view in your WelcomePage activity. Double check that the layout file you are using (activity_welcome_page) exists in the res/layout folder of your project.
  2. Check the logcat for any other error messages or warnings that might indicate the problem. There might be additional information that can help you understand why the app is not showing up.
  3. Make sure that you have set the correct launcher activity in your AndroidManifest.xml file. This is the activity that will be launched when the app is launched from the home screen.
  4. If you are using an emulator, try running the app on a physical device to see if the issue persists. This can help you determine if the issue is with the emulator or the app itself.
  5. Make sure that you have the latest version of Android Studio and the Android SDK installed. Sometimes issues can arise when using older versions of these tools.
  6. If none of these suggestions help, try cleaning and rebuilding your project. This can sometimes resolve issues with the build process. To do this, go to Build > Clean Project and then Build > Rebuild Project.

CodePudding user response:

I went to Run > Edit Configurations and set launch to a Specified Activity. I then set the specified activity and in AndroidMainfest.xml, inside the activity tag, I set exported=true. Now it works.

  • Related