gpt4 book ai didi

android - 无法执行 dex : Multiple dex files define & java. lang.NoClassDefFoundError

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

我在 2 个错误之间。我不知道该怎么办。第一个错误:

[2014-07-04 15:07:01 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/gdata/util/common/base/Escaper;

[2014-07-04 15:07:01 - MyGov] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/gdata/util/common/base/Escaper;Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

按照建议here , 未选中的 Android 私有(private)库

enter image description here

我已将所有库(来自 AndroidPrivateLibraries)添加到 libs 中,除了 support-v4-18.0.4.jar 库(这会导致之前所述的错误)。

enter image description here

SplashActivity(此 Activity 在应用程序启动时打开)工作正常。但是当我尝试打开 MainActivity 时出现以下错误:

java.lang.NoClassDefFoundError: com.globalsolutions.mygov.ui.MainActivity

根据 this solution , 应检查 Android 私有(private)库。

结论:

error#1 makes me to uncheck Android Private libraries
error#2 makes me to re-check Android Private libraries

这种情况怎么办?如何解决这个问题呢?感谢您抽出宝贵时间!

更新:

控制台中错误 1 ​​的通知:

[2014-07-04 15:06:48 - MyGov] Dx trouble writing output: already prepared [2014-07-04 15:07:01 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/gdata/util/common/base/Escaper; [2014-07-04 15:07:01 - MyGov] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/gdata/util/common/base/Escaper;

错误 2 的 Logcat:

07-04 15:15:07.679: E/AndroidRuntime(26204): FATAL EXCEPTION: main 07-04 15:15:07.679: E/AndroidRuntime(26204): java.lang.NoClassDefFoundError: com.globalsolutions.mygov.ui.MainActivity 07-04 15:15:07.679: E/AndroidRuntime(26204): at com.globalsolutions.mygov.ui.SplashActivity.startMainActivity(SplashActivity.java:174) 07-04 15:15:07.679: E/AndroidRuntime(26204): at com.globalsolutions.mygov.ui.SplashActivity$6$3.run(SplashActivity.java:275) 07-04 15:15:07.679: E/AndroidRuntime(26204): at android.os.Handler.handleCallback(Handler.java:587) 07-04 15:15:07.679: E/AndroidRuntime(26204): at android.os.Handler.dispatchMessage(Handler.java:92) 07-04 15:15:07.679: E/AndroidRuntime(26204): at android.os.Looper.loop(Looper.java:130) 07-04 15:15:07.679: E/AndroidRuntime(26204): at android.app.ActivityThread.main(ActivityThread.java:3687) 07-04 15:15:07.679: E/AndroidRuntime(26204): at java.lang.reflect.Method.invokeNative(Native Method) 07-04 15:15:07.679: E/AndroidRuntime(26204): at java.lang.reflect.Method.invoke(Method.java:507) 07-04 15:15:07.679: E/AndroidRuntime(26204): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 07-04 15:15:07.679: E/AndroidRuntime(26204): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 07-04 15:15:07.679: E/AndroidRuntime(26204): at dalvik.system.NativeStart.main(Native Method) 07-04 15:15:07.687: E/liblog(1516): failed to call dumpstate 07-04 15:15:07.687: E/(1516): Dumpstate > /data/log/dumpstate_app_error

主要 Activity 代码:

package com.globalsolutions.mygov.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.globalsolutions.mygov.Preferences;
import com.globalsolutions.mygov.R;
import com.globalsolutions.mygov.ui.master.MasterWizardActivity;
import com.google.analytics.tracking.android.EasyTracker;

public class MainActivity extends BaseActivity {
public static final String TAG = MainActivity.class.getSimpleName();

private LinearLayout warningContainer;
private TextView warningLabel;
private Button history;
private Button appeal;
private Button call;
private Button about;
private Button settings;

private Preferences prefs;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().hide();
setContentView(R.layout.activity_main);
initViews();

prefs = Preferences.getInstance(this);
}


@Override
public void onResume() {
Preferences.refActivity = this;
super.onResume();
}


/**
* Поиск и инициализация вьюшек
*/
private void initViews() {
warningContainer = (LinearLayout) findViewById(R.id.warning);
warningLabel = (TextView) findViewById(R.id.warningLabel);
history = (Button) findViewById(R.id.history);
appeal = (Button) findViewById(R.id.appeal);
call = (Button) findViewById(R.id.call);
about = (Button) findViewById(R.id.about);
settings = (Button) findViewById(R.id.settings);

Intent intent = getIntent();
if (intent != null) {
String status = intent.getStringExtra("status");
if (!"success".equals(status)) {
warningContainer.setVisibility(View.VISIBLE);
history.setEnabled(false);
appeal.setEnabled(false);
}
}
}

/**
* История обращений
* @param v
*/
public void historyClick(View v) {
EasyTracker.getTracker().sendEvent("Главное меню", "Выбран пункт", "История обращений", (long) 0);
Intent i = new Intent(getApplicationContext(), RequestsListActivity.class);
startActivity(i);
overridePendingTransition(0, 0);
}

/**
* Подать обращение
* @param v
*/
public void appealClick(View v) {
EasyTracker.getTracker().sendEvent("Главное меню", "Выбран пункт", "Подать обращение", (long) 0);
Intent i = new Intent(getApplicationContext(), MasterWizardActivity.class);
startActivity(i);
overridePendingTransition(0, 0);
}

/**
* Позвонить в Call-центр
* @param v
*/
public void callClick(View v) {
EasyTracker.getTracker().sendEvent("Главное меню", "Выбран пункт", "Позвонить в call-центр", (long) 0);
dialPhone();
}

/**
* О приложении
* @param v
*/
public void aboutClick(View v) {
EasyTracker.getTracker().sendEvent("Главное меню", "Выбран пункт", "О приложении", (long) 0);
Intent intent = new Intent(this, AboutActivity.class);
startActivity(intent);
}

/**
* Настройки
* @param v
*/
public void settingsClick(View v) {
EasyTracker.getTracker().sendEvent("Главное меню", "Выбран пункт", "Настройки", (long) 0);
Intent intent = new Intent(this, PreferencesActivity.class);
startActivity(intent);
}

@Override
public void onStart() {
super.onStart();
EasyTracker.getInstance().activityStart(this);
}

@Override
public void onStop() {
super.onStop();
EasyTracker.getInstance().activityStop(this);
}
}

最佳答案

I am between 2 errors. I dont know what to do. 1st error:

这个错误是不言自明的。您包括 2 个以上具有重复项的 JAR(或一个 JAR 加上您自己的 Java 类)。

解决方案是确定重复项的来源(例如,检查 JAR),然后找出要更改或删除的 JAR。

As suggested here, unchecked Android Private Libraries

我否决了这个答案,因为它是相当错误的。

I have added all libraries(from AndroidPrivateLibraries) into libs except support-v4-18.0.4.jar library(which is causing to before stated error).

我将这句话解释为“当我添加 support-v4-18.0.4.jar 时,我开始遇到构建错误”。在这种情况下,您知道两个 JAR 之一是问题的根源。鉴于冲突的类名,我猜测另一个是 libGoogleAnalyticsV2.jar。您需要:

  1. 找到这些 JAR 的设计用于协同工作的版本,或者

  2. 摆脱其中一个 JAR。

关于android - 无法执行 dex : Multiple dex files define & java. lang.NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24572360/

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