SDK Box - Android Studio - Program type already present Error

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 ?

so I’ll try the two plugins in one project.

You’re going to try them both together right?

I am also using SDK google analytics. Just in case

BUILD SUCCESSFUL

Total time: 14.08 secs
PREDEX CACHE HITS:   0
PREDEX CACHE MISSES: 1
Stopped 0 worker daemon(s).
Received result Success[value=null] from daemon DaemonInfo{pid=44585, address=[7ec2bc11-f1a0-46f6-ae2d-c1e19e7c22cb port:60850, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1524800419384, context=DefaultDaemonContext[uid=d5143b5d-908a-44a1-8252-fe8cb89ef79f,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home,daemonRegistryDir=/Users/admin/.gradle/daemon,pid=44585,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done).
Move apk to /Users/admin/test/cpp316/bin/debug/android
Build succeed.
~/test/cpp316 [master] $ sdkbox info
  _______ ______  _     _ ______   _____  _     _
  |______ |     \ |____/  |_____] |     |  \___/
  ______| |_____/ |    \_ |_____] |_____| _/   \_
 Copyright (c) 2016-2018 SDKBOX Inc. v1.0.1.34
 installed packages:
     v2.3.17.9 googleanalytics
     v2.3.17.9 sdkboxplay
     v2.3.17.9 facebook
     v2.3.17.9 googleplayservices

with some changed (cpp316/proj.android-studio/gradle.properties):

PROP_COMPILE_SDK_VERSION=25
PROP_MIN_SDK_VERSION=15

en, just remove the android-support-v4.jar file that you find.

You’ll need explain more please. I assume non of the earlier pictures about jar files I shared are relevant then seems your not mentioning them. So that leaves me with no clue about what and where , with this jar file.

Can you help with these jars files. So your saying these plugins do conflict then, because that a jar file needs removing. Please help friend :frowning:

I’m so sorry for oversimplified answer.

I tried a cpp316 project with some plugins but without your issue.

     v2.3.17.9 googleanalytics
     v2.3.17.9 sdkboxplay
     v2.3.17.9 facebook
     v2.3.17.9 googleplayservices

Could u share your test project in Github, then I can fix it for you.
Thanks,

Hi, I also experienced some conflicts with the android-support-v4.jar after importing Admob and PluginSdkboxAds.

Reproducing what I had done to solve it:

  1. Change your PROP_COMPILE_SDK_VERSION / PROP_MIN_SDK_VERSION / PROP_TARGET_SDK_VERSION variables to be compatible with sdkbox libraries.
    These variables can be found in your file named “OrbitalRushApp/proj.android-studio/gradle.properies”

For example to enable AdMob I changed mine configuration to:

 PROP_COMPILE_SDK_VERSION=24
 PROP_MIN_SDK_VERSION=21
 PROP_TARGET_SDK_VERSION=24
 PROP_APP_PLATFORM=14
 PROP_APP_ABI=armeabi
  1. Enable multiDex. This can be done in your file: OrbitalRushApp/proj.android-studio/app/build.gradle

in your comment I can’t see this flag anywhere, for example you can add this flag after the versionName:

android{
 defaultConfig{
  ...
  versionName "1.8"
  multiDexEnabled true
  ...}
...}

Also, for what I can see in your file, you have:

 compileSdkVersion 23 

and a new helloWorld project have:

  compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()

So be maybe you will have to change the compileSdkVersion with the same number you put in PROP_COMPILE_SDK_VERSION in part 1)

Hope this help :slight_smile:

I restarted the project ages ago. i cant share until I get back to that stage again. Ill be hesitant do so because i had to restart project three times now and that also included a google play services entire new everything.

Before I get back to this stage ill message you