java - Android 由 : java. lang.RuntimeException 引起

标签 java android runtimeexception

我收到一条错误消息,就像标题中一样,但没有上下文,它的原因是:java.lang.RuntimeException 如果我不知道导致它的原因,我该如何知道要修复什么。代码在这里:https://bitbucket.org/Hellscythe94/meet-up/src/master/

当我将此行添加到登录 fragment 时显示错误: 警报对话框.show();

但是即使我评论了它也不起作用......

请帮助我,我刚刚开始使用 android。

好的,我创建了一个新的空白项目,只是添加了依赖项并尝试构建它,但遇到了同样的问题。

This is my project/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是我的项目/app/build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        multiDexEnabled true
        applicationId "com.example.michalwolowiec.meetup"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    def lifecycle_version = "1.1.1"
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //MultiDex
    implementation 'com.android.support:multidex:1.0.3'
    //App compat
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    //ViewModel and LiveData
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"
    //Lifecycles only (no ViewModel or LiveData).
    //Support library depends on this lightweight import
    implementation "android.arch.lifecycle:runtime:$lifecycle_version"
    //firebase Authentication
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    //firebase cloud Firebase
    implementation 'com.google.firebase:firebase-firestore:17.1.4'
    //butterknife and lombok
    implementation 'com.jakewharton:butterknife:9.0.0-rc1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'
    compileOnly 'org.projectlombok:lombok:1.18.4'
    annotationProcessor 'org.projectlombok:lombok:1.18.4'
    //google shit
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    //RX
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.3'
    //libraries
    implementation 'io.nlopez.smartlocation:library:3.3.3'
    implementation 'io.nlopez.smartlocation:rx:3.3.1'
    implementation 'com.google.code.gson:gson:2.8.5'
    //tests
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply 
plugin: 'com.google.gms.google-services'

现在有人可以告诉我我做错了什么吗?

The problem

最佳答案

好的,我解决了。

事实证明,因为我得到了这是我的project/app/build.gradle

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

但是删除后它可以正常工作。 所以问题可能是我正在做一些在 JAVA 1.7 中可以接受但在 JAVA 1.8 中 Not Acceptable 事情。

关于java - Android 由 : java. lang.RuntimeException 引起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53802932/

相关文章:

android - 如何在android中的drawable上添加阴影效果

java - 请解释Java中的RuntimeException以及应该在哪里使用

java - Android Studio - 编译错误 : (App keeps stopping) -> RuntimeException: Unable to instantiate activity

java - 从 Java 小程序访问输入类型 ="file"完整路径

java - 尝试在 Mac 上将文件另存为 .dat

java - 找不到 java applet html 转换器

java - MapReduce键值对产生垃圾值的输出值

android - 处理状态栏通知

android - 用于 Android 的 Java 通用补间引擎或 ObjectAnimator

java - RuntimeException:无法分派(dispatch)事件@otto