当我创建一个新项目时选择'空白活动'在Android Studio中构建它而不进行任何编辑当我在三星Galaxy S4 mini上测试时,我收到错误和警告。我在Nexus 5仿真器上没有这些问题。
我环顾四周,我认为它与使用" ActionBarActivity"有关。我确保我的S4 mini比我选择的最低版本的API更高版本,即API 15。
我改变了我的延伸' ActionBarActivity'到'活动',错误就消失了。
我的问题是我不明白为什么会发生这种情况,但更重要的是,我还是可以使用操作栏吗?它在S4 Mini上显示正常,但我收到了这个错误。
我有最新的Android Studio版本(1.1.0)。我没有运行调试器。 (我看到有人在较旧的帖子中提到过)
这是logcat,错误是第一行:
03-30 20:24:20.489 11164-11164/erasenothigntest.com.erase_testproject E/SELinux﹕ selinux_android_seapp_context_reload: seapp_contexts file is loaded from /seapp_contexts
03-30 20:24:20.489 11164-11164/erasenothigntest.com.erase_testproject D/dalvikvm﹕ Late-enabling CheckJNI
03-30 20:24:20.690 11164-11164/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
03-30 20:24:20.700 11164-11164/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 12208: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
03-30 20:24:20.700 11164-11164/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
03-30 20:24:20.700 11164-11164/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
03-30 20:24:20.700 11164-11164/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 12214: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
03-30 20:24:20.700 11164-11164/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
03-30 20:24:20.700 11164-11164/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
03-30 20:24:20.700 11164-11164/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 9779: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
03-30 20:24:20.700 11164-11164/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
03-30 20:24:20.700 11164-11164/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
03-30 20:24:20.710 11164-11164/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 392: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
03-30 20:24:20.710 11164-11164/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
03-30 20:24:20.710 11164-11164/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
03-30 20:24:20.710 11164-11164/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 414: Landroid/content/res/TypedArray;.getType (I)I
03-30 20:24:20.710 11164-11164/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
03-30 20:24:20.710 11164-11164/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawable
03-30 20:24:20.710 11164-11164/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 355: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
03-30 20:24:20.710 11164-11164/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
03-30 20:24:20.710 11164-11164/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawableForDensity
03-30 20:24:20.710 11164-11164/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 357: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
03-30 20:24:20.710 11164-11164/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
03-30 20:24:20.820 11164-11164/erasenothigntest.com.erase_testproject D/libEGL﹕ loaded /system/lib/egl/libEGL_adreno200.so
03-30 20:24:20.830 11164-11164/erasenothigntest.com.erase_testproject D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_adreno200.so
03-30 20:24:20.830 11164-11164/erasenothigntest.com.erase_testproject D/libEGL﹕ loaded /system/lib/egl/libGLESv2_adreno200.so
03-30 20:24:20.840 11164-11164/erasenothigntest.com.erase_testproject I/Adreno200-EGL﹕ <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build: AYELDER_AU_LINUX_ANDROID_JB_2.5.5.04.02.02.092.023+PATCH[ES]_msm8960_JB_2.5.5_CL3556704_release_ENGG (CL3556704)
Build Date: 05/17/13 Fri
Local Branch:
Remote Branch: quic/jb_2.5.5
Local Patches: 34c9e193f12610d3e68dabd6198d2c4bfbc66974 RB: Update the master timestamp of the hw_image in rb_texture_update_aliased
Reconstruct Branch: AU_LINUX_ANDROID_JB_2.5.5.04.02.02.092.023 + 01d3c78 + e6f0547 + LOCAL_PATCH[ES]
03-30 20:24:20.900 11164-11164/erasenothigntest.com.erase_testproject D/OpenGLRenderer﹕ Enabling debug mode 0
03-30 20:25:36.180 11164-11170/erasenothigntest.com.erase_testproject D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
03-30 20:26:04.190 11954-11954/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
03-30 20:26:04.190 11954-11954/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 12208: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
03-30 20:26:04.190 11954-11954/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
03-30 20:26:04.190 11954-11954/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
03-30 20:26:04.190 11954-11954/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 12214: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
03-30 20:26:04.190 11954-11954/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
03-30 20:26:04.190 11954-11954/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
03-30 20:26:04.190 11954-11954/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 9779: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
03-30 20:26:04.190 11954-11954/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 392: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 414: Landroid/content/res/TypedArray;.getType (I)I
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawable
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 355: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawableForDensity
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject W/dalvikvm﹕ VFY: unable to resolve virtual method 357: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
03-30 20:26:04.200 11954-11954/erasenothigntest.com.erase_testproject D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
03-30 20:26:04.270 11954-11954/erasenothigntest.com.erase_testproject D/libEGL﹕ loaded /system/lib/egl/libEGL_adreno200.so
03-30 20:26:04.320 11954-11954/erasenothigntest.com.erase_testproject D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_adreno200.so
03-30 20:26:04.320 11954-11954/erasenothigntest.com.erase_testproject D/libEGL﹕ loaded /system/lib/egl/libGLESv2_adreno200.so
03-30 20:26:04.320 11954-11954/erasenothigntest.com.erase_testproject I/Adreno200-EGL﹕ <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build: AYELDER_AU_LINUX_ANDROID_JB_2.5.5.04.02.02.092.023+PATCH[ES]_msm8960_JB_2.5.5_CL3556704_release_ENGG (CL3556704)
Build Date: 05/17/13 Fri
Local Branch:
Remote Branch: quic/jb_2.5.5
Local Patches: 34c9e193f12610d3e68dabd6198d2c4bfbc66974 RB: Update the master timestamp of the hw_image in rb_texture_update_aliased
Reconstruct Branch: AU_LINUX_ANDROID_JB_2.5.5.04.02.02.092.023 + 01d3c78 + e6f0547 + LOCAL_PATCH[ES]
03-30 20:26:04.360 11954-11954/erasenothigntest.com.erase_testproject D/OpenGLRenderer﹕ Enabling debug mode 0
以下是MainActivity.xml代码:
package erasenothigntest.com.erase_testproject;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
这是布局xml文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
由于