android:process=":newinst",android - newInstance failed: no <init> - Stack Overflow

在尝试启动一个二级扩展活动时遇到了问题,日志显示 'newInstance failed:no()' 错误。问题可能出在没有找到无参数的构造函数。激活活动的代码是通过 Intent 启动的,但具体错误似乎与一个抽象类和其子类的构造函数有关。尽管子类有正确的构造函数并调用了超类构造函数,但 Dalvik VM 仍无法实例化。需要进一步检查类继承结构和构造函数的定义。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I cannot instantiate a sub activity. In the logcat I see this line:

01-22 15:14:38.906: DEBUG/dalvikvm(411): newInstance failed: no ()

This is the line in dalvik that generates that logcat.

/*

* public T newInstance() throws InstantiationException, IllegalAccessException

*

* Create a new instance of this class.

*/

static void Dalvik_java_lang_Class_newInstance(const u4* args, JValue* pResult)

...

/* find the "nullary" constructor */

init = dvmFindDirectMethodByDescriptor(clazz, "", "()V");

if (init == NULL) {

/* common cause: secret "this" arg on non-static inner class ctor */

LOGD("newInstance failed: no ()\n");

dvmThrowExceptionWithClassMessage("Ljava/lang/InstantiationException;",

clazz->descriptor);

RETURN_VOID();

}

Here is the action I take to activate the activity in a timer handler.

// move on to Activation

// ePNSplash is this activity a splash screen

Intent i = new Intent (ePNSplash.this, Activation.class);

startActivity (i);

The activity that I am trying to start is 2 extensions above Activity

Here is the first extension

public abstract class AndroidScreen extends Activity {

....

public AndroidScreen (String title, AndroidScreen parent, AndroidScreen main)

{

super ();

myGlobals = Globals.getGlobals ();

myGlobals.myLogger.logString("AndroidScreen: 001");

myParent = parent;

myMainScreen = main;

myTitle = title;

}

This is only the constructor, which seems to be the part that has the problem. Here is the 2nd extension and the class i am trying to instantiate.

public class Activation extends AndroidScreen {

public Activation (String title, AndroidScreen parent, AndroidScreen main)

{

super (title, parent, main);

}

I am absolutely confused, I have a constructor, I make sure I call my super constructors, what could possibly be wrong?

Thank you

Julian

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值