简体   繁体   English

Android studio 中的登录和注册表单无法解析 class

[英]Login and Registration form in Android studio Unable to resolve class

I am new to programming and need a little bit of noob assistance please.我是编程新手,需要一点菜鸟帮助。 I am busy completing the following tutorial: https://www.androidtutorialpoint.com/androidwithphp/login-and-registration-form-in-android/#ulp-EvSUMG7gujVVNOTG I am having an error that my manifest cannot resolve my classes.:我正忙于完成以下教程: https://www.androidtutorialpoint.com/androidwithphp/login-and-registration-form-in-android/#ulp-EvSUMG7gujVVNOTG我有一个错误,我的清单无法解析我的类。:

Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.holliacc">
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >
        <activity android:name=".LoginActivity" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".RegisterActivity"/>
        <activity android:name=".UserActivity" />
    </application>
</manifest>

Error log:错误日志:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.holliacc, PID: 17425
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.holliacc/com.example.holliacc.LoginActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.holliacc.LoginActivity" on path: DexPathList[[zip file "/data/app/~~kZF1Y8ZOF3c7KaMf5oydhg==/com.example.holliacc-p6ZfAvZpZQUhmyYVsggi2w==/base.apk"],nativeLibraryDirectories=[/data/app/~~kZF1Y8ZOF3c7KaMf5oydhg==/com.example.holliacc-p6ZfAvZpZQUhmyYVsggi2w==/lib/x86, /system/lib, /system_ext/lib, /product/lib]]
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3258)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3484)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)

I have attempted to reach out to the author with no luck.我试图联系作者,但没有成功。 Additionally i have googled but i don't think i understand enough yet to answer my question.另外我用谷歌搜索过,但我认为我还不够了解,无法回答我的问题。

Please help?请帮忙? Also if anyone else has done this tutuorial.另外,如果其他人已经完成了这个教程。 where is the UserActivity class?? UserActivity class 在哪里?

Thanks all!谢谢大家!

add this line in the buildgradlebuildgradle中添加这一行

implementation 'com.android.support:multidex:1.0.3'

and in the same gradle add并在同一个 gradle 添加

defaultConfig {
        applicationId "com.example.project"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        multiDexEnabled true  //add this line
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

after synced project Clean Project from Build -> Clean project从 Build 同步项目Clean Project -> Clean project

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM