Home > Mobile >  app keeps stopping error on Android Studio
app keeps stopping error on Android Studio

Time:12-19

I'm designed an application on Figma and I get the assets via using extension for Android Studio. After that, I'm created a "no activity" from Android Studio, using API 33.

Whatever, Figma plug-in that is "export kit" created a zip file. It contains a java folder, a res folder and "AndroidManifest.xml". When I open the project and follow the "res > layout > login_page_activity.xml" it comes as layout to right side panel. But when I run the application with emulator; the application builded but after start process it suddenly stopped and there was a crash like "Weesi keeps stopping". I can't get the view that I designed on figma. Can anyone help? I'm sharing codes and screenshots.

Figma design screenshot

Figma design screenshot;

Android Studio screenshot

enter image description here

The codes of "login_page_activity";


     
    /*
     *  This content is generated from the API File Info.
     *  (Alt Shift Ctrl I).
     *
     *  @desc       
     *  @file       login_page
     *  @date       Sunday 18th of December 2022 06:47:08 PM
     *  @title      Page 1
     *  @author     
     *  @keywords   
     *  @generator  Export Kit v1.3.figma
     *
     */
    

package exportkit.figma;

import android.app.Activity;
import android.os.Bundle;


import android.view.View;
import android.widget.ImageView;

public class login_page_activity extends Activity {

    
    private View _bg__login_page;
    private ImageView vector;
    private ImageView vector_ek1;
    private ImageView vector_ek2;
    private ImageView vector_ek3;
    private ImageView vector_ek4;
    private ImageView vector_ek5;
    private ImageView vector_ek6;
    private View rectangle_1;
    private ImageView mask_group;
    private ImageView vector_ek7;
    private ImageView mask_group_ek1;
    private ImageView vector_ek8;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_page);

        
        _bg__login_page = (View) findViewById(R.id._bg__login_page);
        vector = (ImageView) findViewById(R.id.vector);
        vector_ek1 = (ImageView) findViewById(R.id.vector_ek1);
        vector_ek2 = (ImageView) findViewById(R.id.vector_ek2);
        vector_ek3 = (ImageView) findViewById(R.id.vector_ek3);
        vector_ek4 = (ImageView) findViewById(R.id.vector_ek4);
        vector_ek5 = (ImageView) findViewById(R.id.vector_ek5);
        vector_ek6 = (ImageView) findViewById(R.id.vector_ek6);
        rectangle_1 = (View) findViewById(R.id.rectangle_1);
        mask_group = (ImageView) findViewById(R.id.mask_group);
        vector_ek7 = (ImageView) findViewById(R.id.vector_ek7);
        mask_group_ek1 = (ImageView) findViewById(R.id.mask_group_ek1);
        vector_ek8 = (ImageView) findViewById(R.id.vector_ek8);
    
        
        //custom code goes here
    
    }
}
    

This usage generates error. So I'm adding the following package;

import "com.example.weesi.R";

It solves. But in this sittuation the big problem is when I click the run on emulator, It gives error that is in the picture;

enter image description here

This is logcat error.

--------- beginning of crash
2022-12-19 10:17:23.762 4426-4426/com.example.weesi E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.weesi, PID: 4426
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.weesi/com.example.weesi.login_page_activity}: java.lang.ClassNotFoundException: Didn't find class "com.example.weesi.login_page_activity" on path: DexPathList[[zip file "/data/app/~~ErUMd9SFlYIDuqrzhu5b3A==/com.example.weesi-SEYRsnvF0Xzn0PVo4BQkXg==/base.apk"],nativeLibraryDirectories=[/data/app/~~ErUMd9SFlYIDuqrzhu5b3A==/com.example.weesi-SEYRsnvF0Xzn0PVo4BQkXg==/lib/x86_64, /system/lib64, /system_ext/lib64]]
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3551)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7872)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.weesi.login_page_activity" on path: DexPathList[[zip file "/data/app/~~ErUMd9SFlYIDuqrzhu5b3A==/com.example.weesi-SEYRsnvF0Xzn0PVo4BQkXg==/base.apk"],nativeLibraryDirectories=[/data/app/~~ErUMd9SFlYIDuqrzhu5b3A==/com.example.weesi-SEYRsnvF0Xzn0PVo4BQkXg==/lib/x86_64, /system/lib64, /system_ext/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
        at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1339)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3538)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loopOnce(Looper.java:201) 
        at android.os.Looper.loop(Looper.java:288) 
        at android.app.ActivityThread.main(ActivityThread.java:7872) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) 
2022-12-19 10:17:23.786 4426-4495/com.example.weesi D/libEGL: loaded /vendor/lib64/egl/libEGL_emulation.so
2022-12-19 10:17:23.791 4426-4495/com.example.weesi D/libEGL: loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="exportkit.figma" >

    <application
        android:allowBackup="true"
        android:theme="@style/AppTheme"
        android:label="@string/app_name" >
        <activity
        android:name=".login_page_activity"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:label="@string/app_name"
        android:exported="true"  >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

</manifest>

Please help me :(

CodePudding user response:

I think you are not registering Activity in AndroidManifest.xml

Please add your Activity in your AndroidManifest.xml

CodePudding user response:

try this code,

<activity
    android:name="com.example.weesi.login_page_activity"
    android:configChanges="orientation|keyboardHidden|screenSize"
    android:label="@string/app_name"
    android:exported="true"  >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Update activity tag in your manifest.

CodePudding user response:

You should add your activities to the "AndroidManifest.xml" file. Add like this,

<activity
android:name="YOUR_ACTIVITY"
android:exported="true"  >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <meta-data
            android:name="android.app.lib_name"
            android:value="" />
</activity>

Then run app again. Then your problem will be solved!

  • Related