java - 是什么导致了 Android Studio 3.1 - java.io.IOException : Failed to find byte code for javax/naming/Referenceable

标签 java mysql android-studio build.gradle

问题陈述

当我在 Android Studio 3.1 项目的 build.gradle 中添加以下实现项目(':mysql-connector-java-3.0.17-ga-bin') 依赖项时,它构建正常,但出现以下失败当尝试运行时。

上下文:

Android Studio 3.1 主要 Activity - Hello World ; mysql-connector-java-3.0.17-ga-bin 该应用程序将成功构建,没有任何警告 应用程序不会以实现依赖性的方式运行 应用程序将在删除实现依赖性的情况下运行

这是 build.grandle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.mysqlexampleproject2"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"

testrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    implementation project(':mysql-connector-java-3.0.17-ga-bin')
}

这里是失败:

失败:构建因异常而失败。

* What went wrong:
Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
> com.android.build.api.transform.TransformException:     java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException:    Failed to find byte code for javax/naming/Referenceable

这是 MySQL 连接器的 build.gradle:

configurations.maybeCreate("default")
artifacts.add("default", file('mysql-connector-java-3.0.17-ga-bin.jar'))

提前致谢!

最佳答案

我认为你从未找到答案。我有同样的问题。也陷入困境。

作为引用,这是 Bill Butterfield https://www.youtube.com/watch?v=bu5Y3uZ6LLM 的示例项目

关于java - 是什么导致了 Android Studio 3.1 - java.io.IOException : Failed to find byte code for javax/naming/Referenceable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49617191/

相关文章:

java - 如何从递归函数中提取基本情况返回?

java - 将非 jar 文件添加到 Java 类路径

java - 将文件上传到服务器的正确/正确方法是什么?

android - 应用程序图标在 7.0 以上的 android 操作系统中不显示。它显示圆形默认启动器图标

android - Kotlin/Android Studio-如何将变量从替代乐趣传递到应用程序的其余部分?

java - 公钥生成和签名计算的椭圆曲线应该相同吗?

php mysql - 搜索字段和类别(如果不为空)

mysql - 无法创建/写入文件 'xxxx.txt'(错误代码 : 13 - Permission denied)

android - 随意拖动手指

java - 如何在gradle中分别调用任务