Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

NoSuchMethodException with QtPositioning and QtMultimediaUtils



  • Hi !

    When I start my application in debug/release mode, I have these warnings:

    W System.err: java.lang.NoSuchMethodException: org.qtproject.qt5.android.positioning.QtPositioning.setActivity [class android.app.Activity, class java.lang.Object]
    W System.err: 	at java.lang.Class.getMethod(Class.java:2072)
    W System.err: 	at java.lang.Class.getMethod(Class.java:1693)
    W System.err: 	at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:586)
    W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtLoader.loadApplication(QtLoader.java:267)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtLoader.startApp(QtLoader.java:505)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtActivityLoader.onCreate(QtActivityLoader.java:166)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtActivity.onCreateHook(QtActivity.java:267)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:274)
    W System.err: 	at android.app.Activity.performCreate(Activity.java:7955)
    W System.err: 	at android.app.Activity.performCreate(Activity.java:7944)
    W System.err: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
    W System.err: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3531)
    W System.err: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3703)
    W System.err: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
    W System.err: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    W System.err: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    W System.err: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2216)
    W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:107)
    W System.err: 	at android.os.Looper.loop(Looper.java:237)
    W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:7948)
    W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
    W System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
    W System.err: java.lang.NoSuchMethodException: org.qtproject.qt5.android.multimedia.QtMultimediaUtils.setActivity [class android.app.Activity, class java.lang.Object]
    W System.err: 	at java.lang.Class.getMethod(Class.java:2072)
    W System.err: 	at java.lang.Class.getMethod(Class.java:1693)
    W System.err: 	at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:586)
    W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtLoader.loadApplication(QtLoader.java:267)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtLoader.startApp(QtLoader.java:505)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtActivityLoader.onCreate(QtActivityLoader.java:166)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtActivity.onCreateHook(QtActivity.java:267)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:274)
    W System.err: 	at android.app.Activity.performCreate(Activity.java:7955)
    W System.err: 	at android.app.Activity.performCreate(Activity.java:7944)
    W System.err: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
    W System.err: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3531)
    W System.err: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3703)
    W System.err: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
    W System.err: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    W System.err: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    W System.err: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2216)
    W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:107)
    W System.err: 	at android.os.Looper.loop(Looper.java:237)
    W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:7948)
    W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
    W System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
    

    I'm using Qt 5.15.1 with NDK 21.1.6352462

    and this build.gradle file

    buildscript {
    	repositories {
    		google()
    		jcenter()
    	}
    	
    	 dependencies {
            classpath 'com.android.tools.build:gradle:4.0.0'
        }
    }
    
    repositories {
    	google()
    	jcenter()
    }
    
    apply plugin: 'com.android.application'
    
    dependencies {
    	implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
            def appcompat_version = "1.1.0"
                implementation "androidx.core:core:$appcompat_version"
                implementation "androidx.appcompat:appcompat:$appcompat_version"
                // For loading and tinting drawables on older versions of the platform
                implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
                implementation "androidx.annotation:annotation:$appcompat_version"
                // To use the Java-compatible @Experimental API annotation
                implementation "androidx.annotation:annotation-experimental:1.0.0"
                implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0"
             
    }
    
    android {
    	/*******************************************************
    		* The following variables:
    		* - androidBuildToolsVersion,
    		* - androidCompileSdkVersion
    		* - qt5AndroidDir - holds the path to qt android files
    		*                   needed to build any Qt application
    		*                   on Android.
    		*
    		* are defined in gradle.properties file. This file is
    		* updated by QtCreator and androiddeployqt tools.
    		* Changing them manually might break the compilation!
    	*******************************************************/
    	
    	compileSdkVersion androidCompileSdkVersion.toInteger()
    	
            buildToolsVersion '29.0.2'
    
            android.ndkVersion '21.1.6352462'
    
            defaultConfig {
             minSdkVersion 23
             targetSdkVersion 29
            }
    
            sourceSets {
    		main {
    			manifest.srcFile 'AndroidManifest.xml'
    			java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
    			aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
    			res.srcDirs = [qt5AndroidDir + '/res', 'res']
    			resources.srcDirs = ['resources']
    			renderscript.srcDirs = ['src']
    			assets.srcDirs = ['assets']
    			jniLibs.srcDirs = ['libs']
    		}
    	}
    	
    	
    	// pour generer des .aab
    	/*bundle {
    		language {
    		// Specifies that the app bundle should not support
    		// configuration APKs for language resources. These
    		// resources are instead packaged with each base and
    		// dynamic feature APK.
    		enableSplit = false
    		}
    		
    		density {
    		// This property is set to true by default.
    		enableSplit = true
    		}
    		
    		abi {
    		// This property is set to true by default.
    		enableSplit = true
    		}
    		
    	}*/
    
            // Pour generer des apk
            splits {
    		    abi {
                 //     enable true
    		    }
            }
    	
            lintOptions {
    		   abortOnError false
    		   checkReleaseBuilds false
    	    }
    	  
    	    // Do not compress Qt binary resources file
            aaptOptions {
    	      	noCompress 'rcc'
            }
    	
            packagingOptions {
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/license.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/ASL2.0'
            exclude 'META-INF/androidx*'
         }
    }
    

    What can I do ?

    Thanks!



  • Am I the only one to have this?



  • The problem seems to be reported here: https://bugreports.qt.io/browse/QTBUG-86733



  • @Francky033 I also have run into it. Have you found a solution?


Log in to reply