I am running into trouble either setting up the support v7 GridLayout library in my IntelliJ project, or properly referencing it in my code.
I currently use the ActionBarSherlock and Facebook libraries in my project, and have set up the support GridLayout library the same way (not having source in the src folder, I told IntelliJ to use the project dir as a jar folder). Everything looked fine, built and deployed to my test device, but when I tried to inflate the layout, my app crashed.
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 android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1160) at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558) 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.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:857) at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:251) at com.example.MainHostActivity.onCreate(MainHostActivity.java:58) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717) ... 11 more Caused by: java.lang.ClassNotFoundException: android.support.v7.widget.GridLayout in loader dalvik.system.PathClassLoader[/data/app/com.example.MyApp.apk] at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) at java.lang.ClassLoader.loadClass(ClassLoader.java:573) at java.lang.ClassLoader.loadClass(ClassLoader.java:532) at android.view.LayoutInflater.createView(LayoutInflater.java:466) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565) ... 30 more
IntelliJ is also telling me that my GridLayout is "not allowed here" in the XML designer, which I unable to find any help on in various search engines. My layout (truncated for length) is as follows:
Coles Notes: I have a support GridLayout in a RelativeLayout and a LinearLayout that sits on top, anchored at the bottom of the RelativeLayout.
The log indicates I am missing a class. I am hoping I just didn't set the library up properly, as I can't think of what else it could be. Hopefully someone with some IntelliJ/Android knowledge can point me in the right direction.
Please go easy on me if this question is missing some info - this is my first try at using stackoverflow to ask for help.
Thanks in advance