Android Studio cannot debug c++ code. prompt Dual (Java + Native) (15971)(disassembly)

71 Views Asked by At

Screenshot of disassembly

I think some third-party libraries may have some security measures to prevent the app from being debugged. I wonder if anyone has encountered this situation?

env:

Android Studio Giraffe | 2022.3.1 Patch 2
java version "11.0.20" 2023-07-18 LTS

below are some of my config files.

CMakeList.txt :

cmake_minimum_required(VERSION 3.4.1)

SET(TARGET native-lib)

file(GLOB src "jni/*.cpp" "jni/benchmark/*.cpp" "jni/MallocTest.cpp")

add_library( # Specifies the name of the library.
             ${TARGET}

             # Sets the library as a shared library.
             SHARED

             # Provides a relative path to your source file(s).
            ${src}
)

find_library( # Sets the name of the path variable.
        log-lib

        # Specifies the name of the NDK library that
        # you want CMake to locate.
        log
)

TARGET_INCLUDE_DIRECTORIES(
        ${TARGET}
        PRIVATE ${EXT_DEP}/include
)

target_link_libraries( # Specifies the target library.
        ${TARGET}

        # Links the target library to the log library
        # included in the NDK.
        PRIVATE ${log-lib}
)

build.gradle :

android {
    compileSdkVersion rootProject.ext.android["compileSdkVersion"]
    buildToolsVersion rootProject.ext.android["buildToolsVersion"]
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId ""
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        versionCode rootProject.ext.android["versionCode"]
        versionName rootProject.ext.android["versionName"]
        // Enabling multidex support.
        multiDexEnabled true
        multiDexKeepProguard file('maindexlist.pro') 
        ndk {
            abiFilters 'arm64-v8a'
        }
        packagingOptions {
            pickFirst 'lib/arm64-v8a/*.so'
            pickFirst 'lib/armeabi-v7a/*.so'
            exclude '**/x86/*.so'
            exclude '**/x86_64/*.so'
            exclude '**/armeabi/*.so'
            exclude '**/mips/*.so'
            exclude '**/mips64/*.so'
        }
        resConfigs "zh-rCN"
        vectorDrawables.generatedDensities = ['hdpi']
        // 华为支付
        resConfigs "en", "zh-rCN"

        //ARouter start
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"]
            }
        }

        buildConfigField "String", "GIT_HASH", "\"${gitHash}\""
        buildConfigField "String", "GIT_BRANCH", "\"${gitBranch}\""
        buildConfigField "boolean", "dependSongStudio", "${rootProject.ext.dependSongStudio}"
        //ARouter end

        vectorDrawables.useSupportLibrary = true

        javaCompileOptions {
            annotationProcessorOptions {
                arguments += [
                        "room.schemaLocation"  : "$projectDir/schemas".toString(),
                        "room.incremental"     : "true",
                        "room.expandProjection": "true"]
            }
        }

        manifestPlaceholders = [
                ZX_APPID: "xxx"
        ]
    }

    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }

    signingConfigs {
        debug {
            storeFile file("")
            storePassword ""
            keyAlias ""
            keyPassword ""
        }

        release {
            storeFile file("")
            storePassword ""
            keyAlias ""
            keyPassword ""
        }
    }

    buildTypes {
        debug {
            debuggable true
            minifyEnabled false
            zipAlignEnabled false
            shrinkResources false
            signingConfig signingConfigs.debug
        }

        release {
            zipAlignEnabled true
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
            signingConfig signingConfigs.release
        }

    }

    dexOptions {
        maxProcessCount 6
        jumboMode true
        javaMaxHeapSize "6g"
        incremental true
        preDexLibraries true
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    productFlavors {
    }

    android.buildFeatures.dataBinding = true

    aaptOptions {
        File publicTxtFile = project.rootProject.file('public.txt')
        if (publicTxtFile.exists()) {
            additionalParameters "--stable-ids", "${project.rootProject.file('public.txt').absolutePath}"
        } else {
            additionalParameters "--emit-ids", "${project.rootProject.file('public.txt').absolutePath}"
        }
    }

    if (project.hasProperty('devBuild')) {
        aaptOptions.cruncherEnabled = false
    }

    repositories {
        flatDir {
            dirs project(':livenessLib').file('libs')
        }
    }
}
0

There are 0 best solutions below