1

我刚刚在 android 助手中设置了一个非常简单的 RoboGuice 项目。

它编译和 dexes 很好,安装也很好,但是当我运行项目时,它只是崩溃了......

目录结构:

/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

主要构建.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()
    }
}

子目录 app 中的 build.gradle:

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();
        }
    }
}

主.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>

不幸的是,在 aide-logcat 中没有日志...

该应用程序启动,然后android系统只是说'TestApp3被终止'

有人有想法吗?

[编辑] 附加信息:助手 ide 似乎还不支持所有 java 注释......可能这是问题的原因......

其他原因(?):注入用proguard过滤的注释?

4

0 回答 0