gpt4 book ai didi

android - 我的简单表单 Activity 不运行 (Android)

转载 作者:行者123 更新时间:2023-11-30 02:01:07 25 4
gpt4 key购买 nike

这可能是一个基本问题,但我不知道如何解决。我正在尝试运行一个简单的示例代码来使用来自 here 的名为 NexusDialog 的库创建表单(Android 5.1.1.API 22) ,但是当我想运行它时(在引用所需的库代码后给出),我看到了流行的 FATAL EXCEPTION 错误,如下所示。我该如何解决?

07-16 14:24:07.959: E/AndroidRuntime(22469): FATAL EXCEPTION: main
07-16 14:24:07.959: E/AndroidRuntime(22469): Process: com.example.test, PID: 22469
07-16 14:24:07.959: E/AndroidRuntime(22469): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.test/com.example.test.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.test.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.test-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

这是主要代码(上传的确切项目文件夹 here )

package com.example.test;

import java.util.Arrays;
import com.github.dkharrat.nexusdialog.FormActivity;
import com.github.dkharrat.nexusdialog.controllers.EditTextController;
import com.github.dkharrat.nexusdialog.controllers.FormSectionController;
import com.github.dkharrat.nexusdialog.controllers.SelectionController;

/**
* Demonstrates the bare minimum to display a form in an Activity.
*/
public class MainActivity extends FormActivity {

@Override protected void initForm() {
setTitle("Simple Example");

FormSectionController section = new FormSectionController(this, "Personal Info");
section.addElement(new EditTextController(this, "firstName", "First name"));
section.addElement(new EditTextController(this, "lastName", "Last name"));
section.addElement(new SelectionController(this, "gender", "Gender", true, "Select", Arrays.asList("Male", "Female"), true));

getFormController().addSection(section);
}
}

最佳答案

我检查了你上传的项目
您似乎只添加了 jar 文件,而不是 NexusDialog 中的正确指令
因为 Activity 使用了一些自定义资源(不能通过 jar 文件添加),所以您需要按照指南将 NexusDialog 添加为 depedencies 项目。

关于android - 我的简单表单 Activity 不运行 (Android),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31466934/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com