Quantcast
Channel: cocos2d-x - Cocos Forums
Viewing all articles
Browse latest Browse all 2748

App crashes on a few older android devices

$
0
0

@YogiRob wrote:

I’m trying to update my game to the cocos2dx 3.17.2. It’s a simple game. The previous release supported >99% of devices with v3.4. The current version works just fine with the vast majority of tested devices using v4.4.2+.

We are getting a few reports of crashes on a few old devices. We have only been able to see what we think is the bug on a Nexus Player running AndriodTV6. The bug has been reported on 4.4.2, 5.1 & 6.

I’m using:
Android Gradle Plugin Version: 3.5.3
Gradle Version: 5.4.1

gradle.properties:
PROP_COMPILE_SDK_VERSION=22
PROP_MIN_SDK_VERSION=17
PROP_TARGET_SDK_VERSION=28
PROP_APP_PLATFORM=16
PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86
NDK_PROJECT_PATH=“C:\Users\Rob\AppData\Local\Android\Sdk\ndk-bundle”

APP_STL=c++_static

build.gradle (Project: proj.android-studio):

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

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath ‘com.android.tools.build:gradle:3.5.3’

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

}

allprojects {
repositories {
google()
jcenter()

}

}

build.gradle (libcocos2dx-with-controller):
apply plugin: ‘com.android.library’

android {
compileSdkVersion = 28

defaultConfig {
    minSdkVersion PROP_MIN_SDK_VERSION
    targetSdkVersion PROP_TARGET_SDK_VERSION
    versionCode 1
    versionName "1.0"
}

sourceSets.main {
    aidl.srcDir "../java/src"
    java.srcDirs = ['../java/src','../ControllerManualAdapter/src']
    manifest.srcFile "AndroidManifest.xml"
}

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

}

dependencies {
implementation fileTree(dir: ‘…/java/libs’, include: [’.jar’])
implementation fileTree(dir: ‘…/ControllerManualAdapter/libs’, include: [’
.jar’])
}

build.gradle (MonteTest2)
import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: ‘com.android.application’

android {
compileSdkVersion = PROP_COMPILE_SDK_VERSION.toInteger()

defaultConfig {
    applicationId "com.normaldistribution.montezuma"
    minSdkVersion PROP_MIN_SDK_VERSION
    targetSdkVersion PROP_TARGET_SDK_VERSION
    versionCode 10
    versionName "1.96b"

    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 'Montezuma'
                arguments 'APP_PLATFORM=android-'+PROP_APP_PLATFORM
                
                def module_paths = [project.file("../../cocos2d").absolutePath,
                                    project.file("../../cocos2d/cocos").absolutePath,
                                    project.file("../../cocos2d/cocos/audio").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})
            }
        }
    }

    applicationVariants.all { variant ->
        //if (variant.buildType.name == 'release') {
            variant.mergeAssetsProvider.configure {
                doLast {
                    delete(fileTree(dir: outputDir, includes: ['**/revenge.ini']))
                    delete(fileTree(dir: outputDir, includes: ['**/*.dll']))
                    delete(fileTree(dir: outputDir, includes: ['**/ipad - Copy/**']))
                    delete(fileTree(dir: outputDir, includes: ['**/e*.mp3']))
                    delete(fileTree(dir: outputDir, includes: ['**/trash/**']))
                    delete(fileTree(dir: outputDir, includes: ['**/res/**']))
                    delete(fileTree(dir: outputDir, includes: ['**/internal/**']))
                }
            }
        //}
    }
}

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 {
        storeFile file('xxxxxxxxxxxxxxxxxxxxxxxxx')
        storePassword 'XXXXXXXX'
        keyAlias = 'XXXXXX'
        keyPassword 'XXXXXXXX'
        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(dir: ‘libs’, include: [’*.jar’])
implementation project(’:libcocos2dx-with-controller’)
implementation ‘com.android.support:appcompat-v7:22.2.0’
//implementation ‘com.android.support:leanback-v17:22.2.0’
}

Questions:

  1. There are so many variables with these Android builds, is there a reference somewhere of which SDK works best with which cocos version, etc?
  2. Any troubleshooting ideas?

TIA.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 2748

Trending Articles