Having an issue with Android Studio: I can run my android app the first time I hit "Run" (i.e. the green triangle). It will then start the AVD and load my application so I can test and debug it. But whenever I want to start the application again (i.e. typically after having done some modification) then the gradle build invariably end in:
...
(!) Run Task
Android issues: 1 Error
(!) Program type already present: android.support.v4.app.BackStackRecord$Op
The right hand side pane reads:
Program type already present: android.support.v4.app.BackStackRecord$Op
Message{kind=ERROR, text=Program type already present: android.support.v4.app.BackStackRecord$Op, sources=[Unknown source file], tool name=Optional.of(D8)}
Why is this not loading and restarting the new/modified version of the application. I located misc. threads that posed the same question but none of the advice given there helped me fix this. So I still always need to kill the AVD and restart it which is most tedious and time-consuming because it then always first needs to reboot! How can I fix this?
My application's gradle file reads:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "myapp.application.mmo.myapp"
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:28.0.0-alpha3'
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'
}
What am I missing? Why is this not working and replacing the installed app with the new version?
PS.: I won't claim that the previous Eclipse-based Android development environment was perfect. It was definitely far from that! But with that IntelliJ-based environment I have far more troubles and weirdoes! If things don't work here I always find it extremely difficult and time-consuming to figure out why something doesn't work!