-1

I'm a beginner in android app development using Kotlin. When I run my app in my AVD(oreo), it runs fine. When the app is installed in the real device(nougat), it gets stopped. I think in my SDK versions the required API level for that is not installed. When the same real device is used as AVD(using USB debugging) the app get stopped like earlier with the APK.

image

I installed the required API levels(of nougat) and the app runs fine in the real device connected through AVD. Now when the new APK is installed in the real device(after properly uninstalling) it has the same problem again.

Here is my build.grable configurations.

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.alrubaye.tictactoylocal"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
Zoe
  • 27,060
  • 21
  • 118
  • 148
Kshitij
  • 339
  • 1
  • 10
  • 1
    your sdk installation seems to okay, no problem – Basi Jan 18 '19 at 12:41
  • try a signed apk or try to run app from android studio after connecting the real device. – Banee Ishaque K Jan 18 '19 at 12:41
  • 2
    "it gets stopped" -- if you mean that your app is crashing, use Logcat to examine the stack trace associated with the crash: https://stackoverflow.com/q/23353173/115145 – CommonsWare Jan 18 '19 at 12:43
  • build.gradle is ok. Run app on device and check logcat to find error message for your app – Tolik Odukha Jan 18 '19 at 12:44
  • What do you mean when you say the "app gets stopped"? Did it crash or the build failed? Also, what build variant are you trying to run? – mcassiano Jan 18 '19 at 12:46
  • @TolikOdukha `java.lang.IllegalStateException: Could not find method buClick(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatButton with id 'bu1'` This is the error which in logcat when the real device is used as AVD without installing other SDKs. – Kshitij Jan 18 '19 at 12:49
  • @CommonsWare Actually I'm building tic-tac game and whenever any button out of the nine buttons is clicked, the app closes with the message 'Unfortunately, App has stopped'. – Kshitij Jan 18 '19 at 12:52

1 Answers1

1

it is not something in your gradle. Error message (from your comment):

java.lang.IllegalStateException: Could not find method buClick(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatButton with id 'bu1

onClick method defined in manifest for button 'bu1' but you no not have corresponding method buClick(View) in your activity. Just check documentation and samples for onClick attribute on Views in manifest and how to implement it. It is trivial.

Tolik Odukha
  • 815
  • 1
  • 8
  • 12