JavaFXPorts MySqlDB-Driver include in project :dex error

后端 未结 1 862
执笔经年
执笔经年 2020-12-07 05:03

I want to create an app/desktopapp which uses a connection to MySqlDB. I used the Gluon plugin in Netbeans. When I want to compile the application for desktop it all works.

相关标签:
1条回答
  • 2020-12-07 05:41

    I've tried with the latest mysql-connector driver (5.1.37) and I've got the same exception when building the apk.

    This exception seems to be related to some issues with the JDK used to compile that driver, and not to mysql not being supported on Android.

    So following this answer on that post, I've used an older version of the driver:

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'org.javafxports:jfxmobile-plugin:1.0.6'
        }
    }
    
    apply plugin: 'org.javafxports.jfxmobile'
    
    repositories {
        jcenter()
    }
    
    dependencies {
        compile 'mysql:mysql-connector-java:3.1.12'
    }
    
    mainClassName = 'com.gluonhq.testsql.TestSQL'
    
    jfxmobile {
        android {
            manifest = 'src/android/AndroidManifest.xml'
            packagingOptions {
                exclude 'META-INF/INDEX.LIST'
            }
        }
        ios {
            forceLinkClasses = [ 'com.gluonhq.**.*', 'com.mysql.**.*']
            infoPList = file('src/ios/Default-Info.plist')
        }
    }
    

    and I was able to build the project and run it successfully on desktop, Android and iOS.

    EDIT

    For iOS, using newer versions of the driver (3.1.13+) causes encoding exceptions.

    0 讨论(0)
提交回复
热议问题