我创建了一个项目,复制了项目中的资源文件,库,将它添加到项目结构中,规定了样式Theme.AppCompat.编译时没有错误,但是当你开始降级时出现异常:
08-03 00:50:00.406: ERROR/AndroidRuntime(4055): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:98)
at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
at com.example.SampleMetrRost.CentralActivity.onCreate(CentralActivity.java:12)
at android.app.Activity.performCreate(Activity.java:4636)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1051)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1924)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1985)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4476)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:816)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:583)
at dalvik.system.NativeStart.main(Native Method)
Run Code Online (Sandbox Code Playgroud)
请帮帮我.今天花了一整天.
我尝试在我的应用程序中使用GridLayout,但它不会工作.我使用了这个教程:IntelliJ和android.support.v7.widget.GridLayout
但它仍然无法运作.
我收到以下错误:
error: No resource identifier found for attribute 'columnCount' in package 'android'
error: No resource identifier found for attribute 'rowCount' in package 'android'
Run Code Online (Sandbox Code Playgroud)
还有什么提示?
编辑:使用我的实际XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:grid="http://schemas.android.com/apk/res-auto"
android:layout_width="350dp"
android:layout_height="fill_parent"
android:orientation="vertical">
<EditText android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:cursorVisible="false"
android:id="@+id/txtName"/>
<android.support.v7.widget.GridLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
grid:columnCount="3"
grid:rowCount="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1,1" />
</android.support.v7.widget.GridLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我在IntelliJ项目中设置支持v7 GridLayout库或在我的代码中正确引用它时遇到了麻烦.
我目前在我的项目中使用ActionBarSherlock和Facebook库,并以相同的方式设置了支持GridLayout库(在src文件夹中没有源代码,我告诉IntelliJ使用项目目录作为jar文件夹).一切看起来很好,构建和部署到我的测试设备,但当我试图给布局充气时,我的应用程序崩溃了.
09-17 17:07:43.916: ERROR/AndroidRuntime(4143): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.example.MainHostActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class android.support.v7.widget.GridLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2753)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
at android.app.ActivityThread.access$2500(ActivityThread.java:129)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2117)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:4717)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class android.support.v7.widget.GridLayout
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.decoderhq.indieshuffle.PlayerFragment.onCreateView(PlayerFragment.java:63)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:846)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1061)
at …Run Code Online (Sandbox Code Playgroud) android intellij-idea grid-layout classnotfoundexception android-support-library