Skip to content

Instantly share code, notes, and snippets.

View ecgreb's full-sized avatar

Chuck Greb ecgreb

View GitHub Profile
@ecgreb
ecgreb / logcat.txt
Created July 30, 2018 21:26
Sample Stack trace
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shopback.app/com.usebutton.sdk.internal.WebViewActivity}: android.view.InflateException: Binary XML file line #18: Failed to resolve attribute at index 1: TypedValue{t=0x2/d=0x7f040003 a=-1}
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
@RunWith(AndroidJUnit4.class)
public class LoginActivityTest {
@Rule public ActivityTestRule<LoginActivity> activityRule =
new ActivityTestRule(LoginActivity.class);
@Test public void useAppContext() throws Exception {
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.ecgreb.mvpc", appContext.getPackageName());
}
@RunWith(RobolectricTestRunner.class)
@Config(manifest="src/main/AndroidManifest.xml", sdk=23)
public class LoginFormTest {
LoginForm loginForm = new LoginForm(RuntimeEnvironment.application);
TextView emailView = (TextView) loginForm.findViewById(R.id.email);
TextView passwordView = (TextView) loginForm.findViewById(R.id.password);
Button signInButton = (Button) loginForm.findViewById(R.id.email_sign_in_button);
TestListener listener = new TestListener();
@Test public void onClickSignInButton_shouldNotInvokeListenerForInvalidInput() throws Exception {
class TestAccountValidator extends AccountValidator {
@Override public void validate(String username, String password, Callback callback) {
if ("valid_username".equals(username) && "valid_password".equals(password)) {
callback.onValidationComplete(true);
} else {
callback.onValidationComplete(false);
}
}
@Override public boolean isValidating() {
class TestLoginController implements LoginController {
boolean progress;
boolean error;
boolean success;
@Override public void showProgress(boolean show) {
progress = show;
}
@Override public void showError() {
public class LoginPresenterTest {
private TestLoginController loginController = new TestLoginController();
private LoginPresenter loginPresenter = new LoginPresenter(new TestAccountValidator());
@Before public void setUp() throws Exception {
loginPresenter.register(loginController);
}
@Test public void onLoginButtonClick_shouldShowSuccessOnValidInput() throws Exception {
loginPresenter.onLoginButtonClick("valid_username", "valid_password");
public class LoginPresenter {
private LoginController loginController;
private AccountValidator accountValidator;
public LoginPresenter(AccountValidator accountValidator) {
this.accountValidator = accountValidator;
}
public void register(LoginController loginController) {
this.loginController = loginController;
public interface LoginController {
void showProgress(boolean show);
void showError();
void finishAndStartMainActivity();
}
03-16 12:00:23.461 7682-7777/? A/art: art/runtime/runtime.cc:422] at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3179)
03-16 12:00:23.461 7682-7777/? A/art: art/runtime/runtime.cc:422] at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3179)
03-16 12:00:23.461 7682-7777/? A/art: art/runtime/runtime.cc:422] at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3179)
03-16 12:00:23.461 7682-7777/? A/art: art/runtime/runtime.cc:422] ... repeated 4 times
03-16 12:00:23.461 7682-7777/? A/art: art/runtime/runtime.cc:422] at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3259)
03-16 12:00:23.461 7682-7777/? A/art: art/runtime/runtime.cc:422] at android.view.ViewRootImpl.doDie(ViewRootImpl.java:5917)
03-16 12:00:23.461 7682-7777/? A/art: art/runtime/runtime.cc:422] - locked <0x0a5e96a2> (a android.view.ViewRootImpl)
03-16 12:00:23.461 7682-7777/? A/art: art/runtime/runtime.cc:422] at android.view.ViewRootImpl.die(ViewRootImpl.
dependencies:
pre:
- if [ ! -e /usr/local/android-sdk-linux/build-tools/25.0.2 ]; then echo y | android update sdk --all --no-ui --filter "build-tools-25.0.2"; fi;
- if [ ! -e /usr/local/android-sdk-linux/platforms/android-25 ]; then echo y | android update sdk --all --no-ui --filter "android-25"; fi;
- if ! $(grep -q "Revision=43.0.0" /usr/local/android-sdk-linux/extras/android/m2repository/source.properties); then echo y | android update sdk --all --no-ui --filter "extra-android-m2repository"; fi;
cache_directories:
- /usr/local/android-sdk-linux/build-tools/25.0.2
- /usr/local/android-sdk-linux/platforms/android-25
- /usr/local/android-sdk-linux/extras/android/m2repository