我要合并两个android项目,一个是Main,另一个是链接为Library。但是我在这条线上有一些麻烦:
Button modificarC;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_menu_calificaciones);
modificarC = (Button) findViewById(R.id.btn_aseso); //HERE
我尝试了 Project Clean ... 我的依赖项也有 android-support-v4.jar
这是我的踪迹:
04-24 19:39:52.568: E/AndroidRuntime(9486): FATAL EXCEPTION: main
04-24 19:39:52.568: E/AndroidRuntime(9486): java.lang.NoSuchFieldError: com.utez.sistemas.sam.R$id.btn_aseso
04-24 19:39:52.568: E/AndroidRuntime(9486): at com.utez.sistemas.sam.calificaciones.CalificacionesActivity.onCreate(CalificacionesActivity.java:67)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.Activity.performCreate(Activity.java:4465)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.access$600(ActivityThread.java:127)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.os.Looper.loop(Looper.java:137)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.main(ActivityThread.java:4507)
04-24 19:39:52.568: E/AndroidRuntime(9486): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 19:39:52.568: E/AndroidRuntime(9486): at java.lang.reflect.Method.invoke(Method.java:511)
04-24 19:39:52.568: E/AndroidRuntime(9486): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
04-24 19:39:52.568: E/AndroidRuntime(9486): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
04-24 19:39:52.568: E/AndroidRuntime(9486): at dalvik.system.NativeStart.main(Native Method)
这里也是布局:
<LinearLayout
style="@style/LoginFormContainer"
android:layout_width="253dp"
android:layout_height="260dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="30dp"
android:orientation="vertical" >
<Button
android:id="@+id/btn_alta"
android:layout_width="match_parent"
android:layout_height="63dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="5dp"
android:background="@drawable/btn_altacalif"
android:contentDescription="@string/action_sign_in_register"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:textAlignment="center" />
<Button
android:id="@+id/btn_aseso"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="5dp"
android:layout_weight="0.16"
android:background="@drawable/btn_modcalif"
android:contentDescription="@string/action_sign_in_register"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:textAlignment="center" />
</LinearLayout>