1

I have just setup a very simple RoboGuice-project in android aide.

It compiles and dexes fine, it also installs fine, but when I run the project, it just crashes...

directory structure:

/storage/emulated/0/AppProjects/TestApp3
  /app
    /build
    /src
      /main
        /java
          /de
            /schadegg
              /testapp3
                MainActivity.java
        /res
          (here we have the normal drawable-folders...) 
          /layout
            main.xml
          (here we have the folders: values, values-v21)
        AndroidManifest.xml
    build.gradle
    proguard-rules.pro
  .gitignore
  build.gradle
  settings.gradle

main build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenLocal()
        mavenCentral()
    }
}

build.gradle in subdirectory app:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        applicationId "de.schadegg.testapp3"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'org.roboguice:roboguice:3.+'

    // should be 'provided' (aide doesn't accept 'provided' ??)
    compile 'org.roboguice:roboblender:3.+'

    compile 'com.google.code.findbugs:jsr305:1.3.9'

    compile fileTree(dir: 'libs', include: ['*.jar'])
}

AndroidManifest.xml:

<manifest package="de.schadegg.testapp3" xmlns:android="http://schemas.android.com/apk/res/android">


<application android:theme="@style/AppTheme" android:label="@string/app_name" android:icon="@drawable/ic_launcher" android:allowBackup="true">


<activity android:label="@string/app_name" android:name=".MainActivity">


<intent-filter>

<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>

</intent-filter>

</activity>

</application>

</manifest>

MainActivity.java:

package de.schadegg.testapp3;

import android.app.*;
import android.os.*;
import android.widget.*;
import android.view.*;

import roboguice.inject.*;
import roboguice.activity.*;

@ContentView(R.layout.main)
public class MainActivity extends RoboActivity 
{
    @InjectView(R.id.mainTextView1)
    private TextView mainTextView1;

    @InjectView(R.id.mainButton1)
    private Button mainButton1;

    public void onMainButton1Click(View view)
    {
        if(mainTextView1 != null) {
            mainTextView1.setText("Button clicked");
        }
        else {
            Toast.makeText(this, "null", Toast.LENGTH_SHORT).show();
        }
    }
}

main.xml:

<?xml version="1.0"?>

<LinearLayout android:gravity="center" android:layout_height="match_parent" android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android">

<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/hello_world" android:id="@+id/mainTextView1"/>

<Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Button1" android:id="@+id/mainButton1" android:onClick="onMainButton1Click"/>

</LinearLayout>

Unfortunatelly, there are no logs in aide-logcat...

The app starts and after that the android system just says 'TestApp3 was terminated'

Anybody got an idea?

[edit] additional info: aide ide does not seem to support all java annotations yet... possibly this is a reason for the problem...

Other reason(?): Inject annotation filtered with proguard?

Markus
  • 357
  • 2
  • 13

0 Answers0