java - 安卓应用无法安装

标签 java android generics dex

在 AIDE for Android 中开发应用程序时,我遇到了这个错误。该应用程序将成功编译但无法安装,并报告此错误:

Could not run the App directly as root. Consider disabling direct running in the settings.

WARNING: linker: app_process has text relocations. This is wasting memory and is a security risk. Please fix.
pkg: /storage/sdcard/AppProjects/MyProgram/bin/MyProgram.apk
Failure [INSTALL_FAILED_DEXOPT]
exit with 0

我研究了可能导致此问题的原因,主要遇到了诸如“证书错误,尝试重新安装包”和“在 list 中设置两次权限”等原因,但均无济于事。

最佳答案

您的问题:Java 认为您定义了两个具有相同签名的方法。

Java 方法签名定义:https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html

method declarations have six components, in order:

1.Modifiers—such as public, private, and others you will learn about later.

2.The return type—the data type of the value returned by the method, or void if the method does not return a value.

3.The method name—the rules for field names apply to method names as well, but the convention is a little different.

4.The parameter list in parenthesis—a comma-delimited list of input parameters, preceded by their data types, enclosed by parentheses, (). If there are no parameters, you must use empty parentheses.

  1. An exception list—to be discussed later.
  2. The method body, enclosed between braces—the method's code, including the declaration of local variables, goes here.

正如您在上面看到的,泛型类的规范不是 java 方法签名的一部分。因此 java 检测到两个具有相同签名的添加方法。

关于java - 安卓应用无法安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31105311/

相关文章:

java - 旋转器 : getItemAtPosition(position) is returning always null/empty

c# - 如何声明通用异步任务?

java - 借助增强的 for 语句,使用关键字 super 访问传递给方法的通用集合的内容

Java Selenium 等待元素超时

android - 实现向上导航

java - Android 在启动应用程序时出现运行时错误

android - 强制 Listview 不重用 View (复选框)

java - java中可以扩展泛型类吗?

java - 选择使用 hibernate

java - 如何为标有自定义注释的属性调用 getter/setter?