0

On s23 when I lunch application it doesn't start. I see that application is stopped. On Samsung s24 it works correctly.

S23 have android 4.4.2 API 19

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{pl../pl..xx..LoginActivity}: java.lang.ClassNotFoundException: Didn't find class "pl...Activity.LoginActivity" on path: DexPathList[[zip file "/data/app/pl..-18.apk"],nativeLibraryDirectories=[/data/app-lib/xx, /vendor/lib, /system/lib]]

This is my manifiest :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="xx.xx.xx">

    <uses-feature
        android:name="android.hardware.camera"
        android:required="true" />
    <uses-feature android:name="android.hardware.location.gps" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/icon80"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="xx.xx.xx.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>


        <service android:name=".Service.UploadPhotosService" />
        <service android:name=".Service.CommunicationsService" />
        <service android:name=".Service.GPSTracker" />

        <activity
            android:name=".Activity.LoginActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar"
            android:windowSoftInputMode="stateVisible|adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
 

</manifest>

build.gradle :

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'


buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {

        classpath 'io.fabric.tools:gradle:1.22.2'
    }
}

repositories {
    mavenCentral()
    maven { url "https://jitpack.io" }
    maven { url 'https://maven.fabric.io/public' }

}

android {
    signingConfigs {
        
        defaultConfig {
            buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
            buildConfigField 'String', 'BUILD_TIME', 'new java.text.SimpleDateFormat("MM.dd.yy HH:mm", java.util.Locale.GERMANY).format(new java.util.Date(' + System.currentTimeMillis() + 'L))'

        }
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }
    compileSdkVersion 27
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "xx.xx.xx"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 37
        versionName "1.3.3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        ndk {
            abiFilters "armeabi-v7a", "x86", "armeabi"
        }
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}

configurations.all {
    resolutionStrategy {
        force 'com.android.support:recyclerview-v7:23.1.1'
        force 'com.android.support:support-annotations:23.1.1'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile(group: 'org.simpleframework', name: 'simple-xml', version: '2.7.1') {
        exclude module: 'stax'
        exclude module: 'stax-api'
        exclude module: 'xpp3'
    }
    //compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
    compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'

    compile('io.socket:socket.io-client:1.0.0') {
        // excluding org.json which is provided by Android
        exclude group: 'org.json', module: 'json'
    }

    // https://mvnrepository.com/artifact/com.google.guava/guava
    compile group: 'com.google.guava', name: 'guava', version: '19.0'

    // https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
    compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.2.0'
    compile group: 'com.squareup.picasso', name: 'picasso', version: '2.5.0'
// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient


    compile('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
        transitive = true;
    }


    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.loopj.android:android-async-http:1.4.9'
    //noinspection GradleCompatible
    compile 'com.android.support:appcompat-v7:24.2.0'
    //noinspection GradleCompatible
    compile 'com.android.support:design:24.2.0'
    compile 'com.daimajia.swipelayout:library:1.2.0@aar'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'net.zetetic:android-database-sqlcipher:3.5.4@aar'
    compile 'com.squareup.moshi:moshi:1.2.0'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    compile 'com.github.orhanobut:hawk:1.23'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'org.jsoup:jsoup:1.11.1'
    compile 'com.android.support:multidex:1.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.google.firebase:firebase-core:11.8.0'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
    // https://mvnrepository.com/artifact/joda-time/joda-time
    compile group: 'joda-time', name: 'joda-time', version: '2.3'
    // https://mvnrepository.com/artifact/org.apache.commons/commons-io

    //noinspection GradleCompatible
    compile 'com.google.android.gms:play-services-identity:11.8.0'
    compile 'com.google.android.gms:play-services-location:11.8.0'

// https://mvnrepository.com/artifact/commons-io/commons-io
    compile group: 'commons-io', name: 'commons-io', version: '2.6'

}
apply plugin: 'com.google.gms.google-services'
1
  • I used to get simmiliar error, then I found out it was because of enabled instant run Commented Aug 20, 2018 at 8:55

2 Answers 2

1

From similar problems I found the most proposed solution is to add this in dependencies:

defaultConfig {
    multiDexEnabled true
} 
Sign up to request clarification or add additional context in comments.

2 Comments

When I remove .Activity it doesn't help
Why did you have it there?
0

As much i understood your problem,i think in your AndroidManifest.xml add a line "android:exported=true" like below

  <activity
        android:name=".Activity.LoginActivity"
        android:exported="true"
        ....></activity>

I think in earlier Versions like API 19 you need to Explicitly include "exported" attribute to let the Machine know the Activity is Present especially Main Activity cause it's a UI needs to Display Something.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.