google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://mediapipe.dev
Apache License 2.0
26.78k stars 5.09k forks source link

add an aar file, the app will crash. #4046

Closed MakeMeCookie closed 1 year ago

MakeMeCookie commented 1 year ago

url : https://google.github.io/mediapipe/getting_started/android_archive_library.html Screenshot from 2023-02-01 15-57-20

I built handtracking on Android. Referred to the above site to create an aar file. Above is the composition of the aar file I made. When I add the aar file to the lib folder and start the app, the app crashes. Is there another way to compile the aar file?

kuaashish commented 1 year ago

Hi @MakeMeCookie, Would you let us know if you are following the target mentioned here to build and run the hands solution? Further we need information about the device which you using in the physical device or in android emulator? However, We suggest that to fill the template to understand more on issue.

MakeMeCookie commented 1 year ago

Screenshot from 2023-02-01 16-11-38 Added .pbtxt and tflite files above. Do you have any missing AAR files? I use Galaxy S9+, Android 10, and api30.

//------------------------------------------------------------------------------------ plugins { id 'com.android.application' }

android { namespace 'com.example.exhandtracking' compileSdk 29

defaultConfig {
    applicationId "com.example.exhandtracking"
    minSdk 21
    targetSdk 29
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    externalNativeBuild {
        cmake {
            cppFlags ''
        }
    }
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
    viewBinding true
}
externalNativeBuild {
    cmake {
        path file('src/main/cpp/CMakeLists.txt')
        version '3.18.1'
    }
}

}

dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
// MediaPipe deps
implementation 'com.google.flogger:flogger:latest.release'
implementation 'com.google.flogger:flogger-system-backend:latest.release'
implementation 'com.google.code.findbugs:jsr305:latest.release'
implementation 'com.google.guava:guava:27.0.1-android'
implementation 'com.google.protobuf:protobuf-javalite:3.19.1'
// CameraX core library
def camerax_version = "1.0.0-beta10"
implementation "androidx.camera:camera-core:$camerax_version"
implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-lifecycle:$camerax_version"
// AutoValue
def auto_value_version = "1.8.1"
implementation "com.google.auto.value:auto-value-annotations:$auto_value_version"
annotationProcessor "com.google.auto.value:auto-value:$auto_value_version"

} //---------------------------------------------------------------------------------------- This is the build.gragle:app I applied.

kuaashish commented 1 year ago

@MakeMeCookie, Please share the complete error logs you are getting with respect to above error.

MakeMeCookie commented 1 year ago

@kuaashish thank you.

All error log files below.

2023-02-01 17:45:45.530 1645-29742 AppErrorNotification pid-1645 D errorType : 24, process : com.example.exhandtracking2 , uid : 0 2023-02-01 17:45:45.551 518-569 SurfaceFlinger pid-518 I id=10286 createSurf (0x0),-1 flag=80004, 342ed7f Application Error: com.example.exhandtracking2#0 2023-02-01 17:45:45.553 983-1050 WindowManager pid-983 V Changing focus from null to Window{342ed7f u0 Application Error: com.example.exhandtracking2} displayId=0 Callers=com.android.server.wm.RootWindowContainer.updateFocusedWindowLocked:204 com.android.server.wm.WindowManagerService.updateFocusedWindowLocked:6458 com.android.server.wm.WindowManagerService.addWindow:1866 com.android.server.wm.Session.addToDisplay:167 android.view.ViewRootImpl.setView:1104 android.view.WindowManagerGlobal.addView:471 2023-02-01 17:45:45.554 983-1052 WindowManager pid-983 I Focus moving from null to Window{342ed7f u0 Application Error: com.example.exhandtracking2} displayId=0 2023-02-01 17:45:45.554 983-1052 WindowManager pid-983 I Gaining focus: Window{342ed7f u0 Application Error: com.example.exhandtracking2} 2023-02-01 17:45:45.565 983-1050 WindowManager pid-983 V Relayout Window{342ed7f u0 Application Error: com.example.exhandtracking2}: viewVisibility=0 req=1078x552 2023-02-01 17:45:45.567 518-569 SurfaceFlinger pid-518 I id=10287 createSurf (1090x564),1 flag=4, Application Error: com.example.exhandtracking2#0 2023-02-01 17:45:45.568 983-1050 WindowManager pid-983 D makeSurface duration=1 name=Application Error: com.example.exhandtracking2 2023-02-01 17:45:45.590 983-1050 WindowManager pid-983 D finishDrawingWindow: Window{342ed7f u0 Application Error: com.example.exhandtracking2} mDrawState=DRAW_PENDING 2023-02-01 17:45:45.590 983-1050 WindowManager pid-983 D setSystemUiVisibility: displayId=0, vis=0x8018, fullVis=0x0, dockVis=0x0, win=Window{342ed7f u0 Application Error: com.example.exhandtracking2} 2023-02-01 17:45:45.591 983-1053 WindowManager pid-983 I Reparenting to leash, surface=Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 2023-02-01 17:45:45.592 518-1898 SurfaceFlinger pid-518 I id=10288 createSurf (0x0),-1 flag=80004, Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 - animation-leash#0 2023-02-01 17:45:45.592 983-1053 WindowManager pid-983 D makeSurface duration=1 leash=Surface(name=Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 - animation-leash)/@0xe510a13 2023-02-01 17:45:45.595 983-1050 WindowManager pid-983 V Relayout Window{342ed7f u0 Application Error: com.example.exhandtracking2}: viewVisibility=0 req=1078x505 2023-02-01 17:45:45.596 983-1050 WindowManager pid-983 I Cancelling animation restarting=true, leash=Surface(name=Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 - animation-leash)/@0xe510a13 2023-02-01 17:45:45.596 983-1050 WindowManager pid-983 I Reparenting to original parent: Surface(name=WindowToken{ec6d320 android.view.ViewRootImpl$W@6d75223})/@0x8c2557c, destroyLeash=false, surface=Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 2023-02-01 17:45:45.596 983-1050 WindowManager pid-983 I Reparenting to leash, surface=Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 2023-02-01 17:45:45.597 518-568 SurfaceFlinger pid-518 I id=10291 createSurf (0x0),-1 flag=80004, Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 - animation-leash#1 2023-02-01 17:45:45.597 983-1050 WindowManager pid-983 D makeSurface duration=1 leash=Surface(name=Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 - animation-leash)/@0x375be5a 2023-02-01 17:45:45.598 518-2013 Layer pid-518 I id=10288 removeFromCurrentState Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 - animation-leash#0 (54) 2023-02-01 17:45:45.598 518-2013 SurfaceFlinger pid-518 I id=10288 Removed Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 - animation-leash#0 (54) 2023-02-01 17:45:45.606 518-2013 BufferQueueProducer pid-518 E [Application Error: com.example.exhandtracking2#0] disconnect: not connected (req=1) 2023-02-01 17:45:45.608 983-1050 WindowManager pid-983 D setSystemUiVisibility: displayId=0, vis=0x8008, fullVis=0x0, dockVis=0x0, win=Window{342ed7f u0 Application Error: com.example.exhandtracking2} 2023-02-01 17:45:45.613 518-518 Layer pid-518 I id=10288[1] Destroyed Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 - animation-leash#0 E [Application Error: com.example.exhandtracking2#0] disconnect: not connected (req=1) 2023-02-01 17:46:01.558 983-1050 WindowManager pid-983 I Reparenting to leash, surface=Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 2023-02-01 17:46:01.558 518-568 SurfaceFlinger pid-518 I id=10292 createSurf (0x0),-1 flag=80004, Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 - animation-leash#0 2023-02-01 17:46:01.559 983-1050 WindowManager pid-983 D makeSurface duration=1 leash=Surface(name=Surface(name=342ed7f Application Error: com.example.exhandtracking2)/@0x86b1102 - animation-leash)/@0x148a387 2023-02-01 17:46:01.560 983-1050 WindowManager pid-983 V Changing focus from Window{342ed7f u0 Application Error: com.example.exhandtracking2 EXITING} to Window{8eb409 u0 com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity} displayId=0 Callers=com.android.server.wm.RootWindowContainer.updateFocusedWindowLocked:204 com.android.server.wm.WindowManagerService.updateFocusedWindowLocked:6458 com.android.server.wm.WindowState.setupWindowForRemoveOnExit:2569 com.android.server.wm.WindowState.removeIfPossible:2538 com.android.server.wm.WindowState.removeIfPossible:2425 com.android.server.wm.WindowManagerService.removeWindow:2086 2023-02-01 17:46:01.567 983-1052 WindowManager pid-983 I Focus moving from Window{342ed7f u0 Application Error: com.example.exhandtracking2 EXITING} to Window{8eb409 u0 com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity} displayId=0 2023-02-01 17:46:01.568 983-1052 WindowManager pid-983 I Losing focus: Window{342ed7f u0 Application Error: com.example.exhandtracking2 EXITING} 2023-02-01 17:46:01.571 983-2787 InputDispatcher pid-983 E Window handle Window{342ed7f u0 Application Error: com.example.exhandtracking2} has no registered input channel


It crashes as soon as I add aar file and install the app.

liangzhengang commented 1 year ago

i cant find the tflite. how to generate this tflite? i use " bazel build -c opt mediapipe/graphs/xxxx:xxxx_binary_graph ” it only generate the binarypb file.please help me thx.............

google-ml-butler[bot] commented 1 year ago

Are you satisfied with the resolution of your issue? Yes No