SDK Box - Android Studio - Program type already present Error

I have been trying to solve this issue for 8 hours

When I compile I get this error

Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompatIcs
Message{kind=ERROR, text=Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompatIcs, sources=[Unknown source file], tool name=Optional.of(D8)}

I have SDK Box Plugins installed which are viewed in mk file

PluginGoogleAnalytics \
sdkbox \
PluginFacebook \
PluginSdkboxAds \
PluginUnityAds \
PluginAdColony \
PluginSdkboxPlay

This issue appeared after I tried installing and using

PluginSdkboxPlay

Can anyone help as I have looked for a solution with no luck

The error used to be a different one with something else at end. It changed and I dont know why

Program type already present: android.support.something.else.was.here

Until I installed PluginSdkboxPlay I had facebook SDK Box and google analytics SDK Box also working fine

Thanks

MODIFIED 2 MINUEST LATER

I removed this

android {dexOptions { preDexLibraries = false }}

Now I am getting another error below

Program type already present: android.support.annotation.Size

MODIFICATION

Removed another line exactly like above in another grade file

Program type already present: android.support.annotation.NonNull

Note I only inserted these lines of code because I was trying solutions
android {dexOptions { preDexLibraries = false }}

I am now going to try remove " multiDexEnabled = true" to see whats the crack as I also inserted this as a hopeful soltuion

New Error

Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompatIcs
Message{kind=ERROR, text=Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompatIcs, sources=[Unknown source file], tool name=Optional.of(D8)}

I did change some “compiles” commands to “implemention” command because it kept say it was depreciated

New Issues has been swapped in after removing " multiDexEnabled = true"

Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompatIcs
Message{kind=ERROR, text=Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompatIcs, sources=[Unknown source file], tool name=Optional.of(D8)}

A note++ search finds

MOFIDIED

I think this is the source of the problem. I did delete these files and they were rebuilt. As we can see in the image above, these are were multi hits are located

More Issues through some looking
Error

Caused by: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\0.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\1.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\2.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\3.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\4.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\5.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\6.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\7.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\8.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\9.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\10.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\11.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\12.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\13.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\14.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\15.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\16.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\17.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\18.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\19.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\20.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\21.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\22.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\23.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\24.jar, C:\Cocos2D-x\Games\OrbitalRushApp\proj.android-studio\app\build\intermediates\transforms\dexBuilder\debug\25.jar
    	at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:124)

This could also have something to do with it

@yinjimmy Do you have any thoughts about this? the OP thinks that the SDKBoc plugins might be conflicting with each other.

@GaddMaster what does sdkbox -version give you? Please post your Android.mk and Application.mk too.

C:\Program Files (x86)\Java\jre1.8.0_171\bin>sdkbox -version
  _______ ______  _     _ ______   _____  _     _
  |______ |     \ |____/  |_____] |     |  \___/
  ______| |_____/ |    \_ |_____] |_____| _/   \_
 Copyright (c) 2016-2018 SDKBOX Inc. v1.0.1.34
usage: sdkbox [-h] [-v] [-p [PROJECT]] [-b [PLUGIN]] [-D SYMBOL] [-q]
              [-d [DAYS]] [-l LEGACY] [--dryrun] [--forcedownload]
              [--noupdate] [--alwaysupdate] [--patcherrors] [--nopatching]
              [--nopatchingcpp] [--jsonapi] [--forcecopy] [--mkey MKEY]
              [--mvalue MVALUE] [--local] [--remote] [--info INFO]
              [--runin RUNIN] [--apitoken APITOKEN] [--silenttime SILENTTIME]
              {import,info,update,forget,restore,list,clean,symbols,version,set,tracking}
sdkbox: error: argument -v/--verbose: ignored explicit argument 'ersion'
C:\Program Files (x86)\Java\jre1.8.0_171\bin>

MK FIle

I am currently opened with hello world game. Ill open her up shortly and get MK file stuff

oops, sorry, I thought there was a -version flag. But your output downs the version you are using: 1.0.1.34

What ya mean. have you noticed something ?

No, but gathering info for @yinjimmy so he can be efficient in his reply.

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/cocos)
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/cocos/audio/include)
$(call import-add-path,$(LOCAL_PATH))

LOCAL_MODULE := MyGame_shared

LOCAL_MODULE_FILENAME := libMyGame

LOCAL_SRC_FILES := $(LOCAL_PATH)/hellocpp/main.cpp \
$(LOCAL_PATH)/../../../Classes/AppDelegate.cpp \
$(LOCAL_PATH)/../../../Classes/Utils.cpp \
$(LOCAL_PATH)/../../../Classes/SessionData.cpp \
$(LOCAL_PATH)/../../../Classes/B2DebugDrawLayer.cpp \
$(LOCAL_PATH)/../../../Classes/GLESRender.cpp \
$(LOCAL_PATH)/../../../Classes/ContactListener.cpp \
$(LOCAL_PATH)/../../../Classes/AudioHandler.cpp \
$(LOCAL_PATH)/../../../Classes/MainMenuScene.cpp \
$(LOCAL_PATH)/../../../Classes/PlayScene.cpp \
$(LOCAL_PATH)/../../../Classes/CreditsScene.cpp \
$(LOCAL_PATH)/../../../Classes/Asteroid.cpp \
$(LOCAL_PATH)/../../../Classes/Missile.cpp \
$(LOCAL_PATH)/../../../Classes/Cannon.cpp \
$(LOCAL_PATH)/../../../Classes/Drone.cpp \
$(LOCAL_PATH)/../../../Classes/Pickup.cpp \
$(LOCAL_PATH)/../../../Classes/PhysicsObject.cpp \
$(LOCAL_PATH)/../../../Classes/GameObject.cpp

LOCAL_CPPFLAGS := -DSDKBOX_ENABLED
LOCAL_LDLIBS := -landroid \
-llog
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes
LOCAL_SHARED_LIBRARIES := libadcolonyso \
libjsso
LOCAL_WHOLE_STATIC_LIBRARIES := PluginGoogleAnalytics \
sdkbox \
PluginFacebook \
PluginSdkboxAds \
PluginUnityAds \
PluginAdColony \
PluginSdkboxPlay

# _COCOS_HEADER_ANDROID_BEGIN
# _COCOS_HEADER_ANDROID_END


LOCAL_STATIC_LIBRARIES := cocos2dx_static

# _COCOS_LIB_ANDROID_BEGIN
# _COCOS_LIB_ANDROID_END

include $(BUILD_SHARED_LIBRARY)

$(call import-module,.)
$(call import-module, ./sdkbox)
$(call import-module, ./plugingoogleanalytics)
$(call import-module, ./pluginfacebook)
$(call import-module, ./pluginsdkboxads)
$(call import-module, ./pluginsdkboxads)
$(call import-module, ./pluginunityads)
$(call import-module, ./pluginadcolony)
$(call import-module, ./pluginsdkboxplay)

# _COCOS_LIB_IMPORT_ANDROID_BEGIN
# _COCOS_LIB_IMPORT_ANDROID_END

seems about multiple dex.

do not remove this.

plz show your build.gradle file.

I think there are two version of v4-support.

one is from gps, another one is from build.gradle.
Thanks,

ref https://stackoverflow.com/questions/20989317/multiple-dex-files-define-landroid-support-v4-accessibilityservice-accessibility?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

I added this to try solve issue. It just caused more issues. Also you say gradle.build. Lots of posts do, but there are many gradle.build files.

As for multiply support . I checked every gradle.build file. There are no visible duplicates . Ill check again to be certain .

I am at the stage now again after starting new project. I am only going to get ask play box working. With leader boards. After wards ill get another new project working with Facebook . I need demo these working today . After that I’ll try all three together in same app to see what happens

So this issue happens when you use SDKBOX importer and your build.gradle(for app(if I remember correctly)) file already contains “support.v4” dependency. So all you need to is go to “proj.android-studio/app/cocos2d/platform/android/jni/java/libs” (can’t tell this at the moment, because I need to check exact project structure on my PC, however I’m unable to do that at the moment of writing this :D), and delete all “supportV4.jar” files :slight_smile:

Thats not the file paths

I think you mean this right

Do i remove that and rebuild ? I think i did try this and it just rebuilt the jar’s again

Because sometimes it did build with no issues, the issue just arose when running… I

After i try to install facebook last it all breaks again and new folders are present here

I can confirm that SDK Play Box and Facebook Box conflict

I started a new project and placed in SDK Play Box and then google analytics. All was good

Then i saved my project and took a dive into trying the Facebook Box. I expected these issues to form again and then did

gradle.build Project: proj.android-studio

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

gradle.build Project: facebook.lib

apply plugin: 'com.android.library'

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

android {
    compileSdkVersion 23
    buildToolsVersion '27.0.3'

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 23
    }

    lintOptions {
        abortOnError false
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.3.0' 
    compile 'com.android.support:cardview-v7:23.3.0' 
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:customtabs:23.3.0'
}

gradle.build Module gps

apply plugin: 'com.android.library'

repositories {
    mavenCentral()
}

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

android {
    compileSdkVersion 22
    buildToolsVersion '27.0.3'

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 22
    }

    lintOptions {
        abortOnError false
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
}

build.gradle : module lib cocos2dx

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion '27.0.3'

    defaultConfig {
        minSdkVersion PROP_MIN_SDK_VERSION
        targetSdkVersion PROP_TARGET_SDK_VERSION
        versionCode 8
        versionName "1.8"
    }

    sourceSets.main {
        aidl.srcDir "../java/src"
        java.srcDir "../java/src"
        manifest.srcFile "AndroidManifest.xml"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile project(':facebook_lib')
    implementation project(':gps')
    implementation fileTree(include: ['*.jar'], dir: '../java/libs')
}

build.gradle : Module SpaceWars

import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "com.GaddBox.SpaceWars"
        minSdkVersion PROP_MIN_SDK_VERSION
        targetSdkVersion PROP_TARGET_SDK_VERSION
        versionCode 8
        versionName "1.8"

        externalNativeBuild {
            ndkBuild {
                if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
                    // skip the NDK Build step if PROP_NDK_MODE is none
                    targets 'MyGame'
                    arguments 'NDK_TOOLCHAIN_VERSION=4.9'
                    arguments 'APP_PLATFORM=android-'+PROP_APP_PLATFORM
                    
                    def module_paths = [project.file("../../cocos2d").absolutePath,
                                        project.file("../../cocos2d/cocos").absolutePath,
                                        project.file("../../cocos2d/external").absolutePath]
                    if (Os.isFamily(Os.FAMILY_WINDOWS)) {
                        // should use '/'
                        module_paths = module_paths.collect {it.replaceAll('\\\\', '/')}
                        arguments 'NDK_MODULE_PATH=' + module_paths.join(";")
                    }
                    else {
                        arguments 'NDK_MODULE_PATH=' + module_paths.join(':')
                    }
                    
                    arguments '-j' + Runtime.runtime.availableProcessors()
                    abiFilters.addAll(PROP_APP_ABI.split(':').collect{it as String})
                }
            }
        }
    }

    sourceSets.main {
        java.srcDir "src"
        res.srcDir "res"
        manifest.srcFile "AndroidManifest.xml"
        assets.srcDir "../../Resources"
    }

    externalNativeBuild {
        ndkBuild {
            if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
                // skip the NDK Build step if PROP_NDK_MODE is none
                path "jni/Android.mk"
            }
        }
    }

    signingConfigs {

       release {
            if (project.hasProperty("RELEASE_STORE_FILE")) {
                storeFile file(RELEASE_STORE_FILE)
                storePassword RELEASE_STORE_PASSWORD
                keyAlias RELEASE_KEY_ALIAS
                keyPassword RELEASE_KEY_PASSWORD
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            if (project.hasProperty("RELEASE_STORE_FILE")) {
                signingConfig signingConfigs.release
            }

            externalNativeBuild {
                ndkBuild {
                    arguments 'NDK_DEBUG=0'
                }
            }
        }

        debug {
            externalNativeBuild {
                ndkBuild {
                    arguments 'NDK_DEBUG=1'
                }
            }
        }
    }
}

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

Still un resolved. Iv been trying everything

When i delete them it doesn’t do anything. I think i deleted them all, but nothing works

In my case, I added “supportv4” dependency in build.gradle because it was required for some functions.
So I had to delete “supportV4.jar” from “<your_game>\cocos2d\cocos\platform\android\java\libs” and
“<your_game>\cocos2d\cocos\platform\android\libcocos2dx\libs”. It helped me. If you want to indicate where your problem is, then in “Android Studio” press “Ctrl + N”, then make sure that “Include non-project classes” box is enabled, and then search for “annotation.NonNull”. If you see duplicate entries, then trace where duplicate file persist - then delete it. :slight_smile: I hope that helps, because thats all I can help you, as I was struggling with this for like 2 days, and this was how I solved it.

I did and I deleted them. When I re build they come back

plz find <project_root> -name android-support-v4.jar,

proj.android/libs/android-support-v4.jar

The paths make no sense

Have a look at the images I shared earlier, do you mean them paths ?