Android вызвано: java.lang.RuntimeException - PullRequest
0 голосов
/ 16 декабря 2018

Я получил сообщение об ошибке, как и в заголовке, но в нем нет контекста, его просто вызвало: java.lang.RuntimeException, как я должен знать, что исправить, если я не знаю, что его вызвало.Код здесь: https://bitbucket.org/Hellscythe94/meet-up/src/master/

Ошибка при добавлении этой строки в фрагмент логина: alertDialog.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

Ответы [ 2 ]

0 голосов
/ 16 декабря 2018

enter image description here Удалите это из вашего Gradle:

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

и добавьте настройки. Все в вашем Gradle:

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
    def requested = details.requested
    if (requested.group == 'com.android.support') {
        if (!requested.name.startsWith("multidex")) {
            details.useVersion '28.0.0'
        }
    }
}
}

enter image description here

0 голосов
/ 16 декабря 2018

ОК, так что я решил это.

Оказывается, потому что я получил это мой проект / app / build.gradle

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

Но при удалении он работает нормально.Таким образом, проблема, вероятно, заключалась в том, что я делал то, что было приемлемо в JAVA 1.7, но не приемлемо в JAVA 1.8.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...