radekdob
radekdob

Reputation: 147

Crashing app after implementation Sceneform

I'm struggling with a strange issue. I tried everything to find a solution to why my app crashes.

The reason is "implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.7.0' ".

When I add this implementation I get error:

java.lang.RuntimeException: Unable to instantiate activity
 ComponentInfo{com.example.myarcore/com.example.myarcore.MainActivity}:
 java.lang.ClassNotFoundException: Didn't find class
 "com.example.myarcore.MainActivity" on path: DexPathList[[zip file
 "/data/app/com.example.myarcore-Aw

This is my app gradle code:

 apply plugin: 'com.android.application'
apply plugin: 'com.google.ar.sceneform.plugin'
apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.myarcore"
        minSdkVersion 26
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

According to MultiDex documentation if app min sdk is higher than 21 then to enable MultiDex all I need is to put multiDexEnabled true as I did.

Upvotes: 0

Views: 453

Answers (1)

radekdob
radekdob

Reputation: 147

SOLVED,

My min SDK was set to 26.

Just add this to your app gradle, even when documentation says that is necessary in min SDK lower than 26.

 compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

Upvotes: 2

Related Questions