0

The following is all installed things in my android studio: enter image description here

I have no other installed API or system images. This is my build.gradle file

plugins {
    id 'com.android.application'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "android.bignerdranch.quiz"
        minSdk 19
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

But despite i have API and system image that uses the same API while debugging, when i am in android SDK's source file, i get this writing: enter image description here

Yeah, i know that there is this topic, but mostly people there advice to disable instant run that doesn't exist in the current version of android studio

Additionally, i tried to do next things:

-Clean project

-Reinstall SDK

-Sync project with Gradle files

-Refresh gradle dependencies

-set minSdkVersion to be the same as Compile and Target

-delete gradle cache file

but anyway i get this message. Any idea how to fix it ?

VanechikSpace
  • 265
  • 2
  • 9
  • It's not about the API, you are debugging an APK running on the device and that APK's source is different than what you have in your Android Studio. The API version you have is irrelevant. Is the APK you are debugging compiled from your PC? – Dan Baruch Jul 24 '22 at 09:58
  • @DanBaruch yes, it is – VanechikSpace Jul 24 '22 at 10:01
  • And were there any modification? Have you tried pressing the bug icon instead of the Play icon when you have Android Studio open with the phone connected? – Dan Baruch Jul 24 '22 at 10:12
  • @DanBaruch it is worth clarifying, this message appears when i'm trying to look at android SDK's source file, but not my own one – VanechikSpace Jul 24 '22 at 10:15
  • By Android SDK you mean like a system app? i.e the file manager that comes with your phone? or maybe the settings app? If that's the case, you need the source of the vendor of your phone. The code of Android you find online is the Vanilla android, OEM change that code to benefit their product more. – Dan Baruch Jul 24 '22 at 10:28
  • i mean, i throw an exception that i am not trying to catch. Then i create java exception breakpoint. when i press bug icon my program stops on the place where i throw the exception. And now i can see stack trace. There is so many methods under the one where i threw the exception. All those are methods of Android SDK. When i choose one of them i can see messsage "source code doesn't match bytecode", though my compileSdk and API that uses the phone are the same. @DanBaruch – VanechikSpace Jul 24 '22 at 10:53
  • I finally understand what you mean. No, you can't debug Android SDK like this, you'll need to download it to your PC and hope you can debug it from there. How ever, Android's code shouldn't be the cause of your exception. Meaning, you are probably using the code incorrectly. It would be better if you created a new question, providing info about the problem you are facing along with the code you are running – Dan Baruch Jul 24 '22 at 10:58

0 Answers0