I have a problem with the signed apk --> the following problem does not appear when I install the apk direct from Android Studio by the "play"-Button.
The start of the app is going on without any problems but when I try to click on a view the following exception appears:
java.lang.IllegalStateException: Could not find method openCurrentFeedback(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.Toolbar with id 'toolbar_top'
at android.view.View$DeclaredOnClickListener.resolveMethod(View.java:4784)
at android.view.View$DeclaredOnClickListener.onClick(View.java:4748)
at android.view.View.performClick(View.java:5714)
at android.view.View$PerformClick.run(View.java:22589)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
I heard something about the build.gradle and especially the propguard file. This are my current settings of gradle.build:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '24.0.0'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.app.app"
minSdkVersion 19
targetSdkVersion 23
versionCode 7
versionName "1.06"
//multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/PPJASCommon.jar')
compile files('libs/easywsdl/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
compile files('libs/gson/gson-2.2.4.jar')
//for autoresize of text
//dependencies for testing
//junit 4
testCompile 'junit:junit:4.12'
//roboeletric for unittests in the jvm without any (emulated) android device
testCompile 'org.robolectric:robolectric:3.0'
//mockito
testCompile 'org.mockito:mockito-core:1.+'
//power mock, for mock ups
testCompile 'org.powermock:powermock-module-junit4:1.6.2'
testCompile 'org.powermock:powermock-api-mockito:1.6.2'
//robotium for ui tests
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.5.4'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'com.android.support:support-v4:23.3.0'
compile 'me.grantland:autofittextview:0.2.1'
}
And my propgurard-rule.pro entry:
-keep public class com.app.*
Again: If I installed the app directly from the android studio (no signed apk) the on click function works without any problems.
I'm testing with a samsung galaxy a5 device which runs android 6.0.1.
Does anyone have any ideas?
Edit: openCurrentFeedback-Method
protected void openCurrentFeedback(View v) {
if (globals.isFeedbackRunning()) {
Intent intent = new Intent();
intent.setClass(v.getContext(), FeedbackManuallyActivity.class);
startActivity(intent);
}
}