Android错误程序类型已存在

时间:2019-02-24 08:21:23

标签: java android

自两天以来,我一直在努力解决错误。希望可以有人帮帮我。 我在MacOS上使用AndroidStudio 3.3.1。构建项目时,我收到以下错误消息:

Error: Program type already present: com.loopj.android.http.BaseJsonHttpResponseHandler

我的 build.gradle 如下:

apply plugin: 'com.android.application'

compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "lalalalalalala"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 7
        versionName "1.6"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation 'com.android.support:design:28.1.0'

    testImplementation 'junit:junit:4.12'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    implementation 'com.github.delight-im:Android-AdvancedWebView:v3.0.0'

    implementation 'com.google.firebase:firebase-messaging:17.4.0'
    implementation 'com.google.firebase:firebase-core:16.0.7'

}

apply plugin: 'com.google.gms.google-services'

我有依赖关系

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.1'
    classpath 'com.google.gms:google-services:4.2.0'
}

在gradle.properties中是

org.gradle.jvmargs=-Xmx1536m

android.useAndroidX=true
android.enableJetifier=true

以及在我拥有的gradle-wrapper.properties中

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

我开始相信是AndroidStudio 3.3.1的错误。 有人在我的代码中看到问题吗? 非常感谢您的帮助:)

编辑:

package lalalalalala;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.webkit.WebViewClient;

import com.loopj.android.http.*;

import im.delight.android.webview.AdvancedWebView;


public class MainActivity extends Activity implements AdvancedWebView.Listener {

    private AdvancedWebView WebView;
    protected static boolean isActivityRunning;

    public static boolean checkIfAppIsRunnung()
    {
        return isActivityRunning;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //Cookies
        AsyncHttpClient myClient = new AsyncHttpClient();
        PersistentCookieStore myCookieStore = new PersistentCookieStore(this);
        myClient.setCookieStore(myCookieStore);

        setContentView(R.layout.activity_main);

        WebView = (AdvancedWebView) findViewById(R.id.webWiew);
        WebView.setListener(this, this);
        WebView.setThirdPartyCookiesEnabled(false);

        Intent mIntent = new Intent(this, MyFirebaseMessagingService.class);
        startService(mIntent);


        WebView.loadUrl("lalalalalalala");
        WebView.setWebViewClient(new WebViewClient());

    }


    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
        super.onActivityResult(requestCode, resultCode, intent);
        WebView.onActivityResult(requestCode, resultCode, intent);
        // ...
    }



    @Override
    public void onPageStarted(String url, Bitmap favicon) { }

    @Override
    public void onPageFinished(String url) { }


    @Override
    public void onDownloadRequested(String url, String suggestedFilename, String mimeType, long contentLength, String contentDisposition, String userAgent) { }

    @Override
    public void onExternalPageRequest(String url) { }

}

0 个答案:

没有答案