Caused by: android.view.InflateException: Binary XML file line #33:
Error inflating class
com.actionbarsherlock.internal.widget.ActionBarView
at android.view.LayoutInflater.createView(LayoutInflater.java:
518)
at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:
623)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:
626)
at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:
207)
at android.app.Activity.setContentView(Activity.java:1657)
at
android.support.v4.app.FragmentActivity.ensureSupportActionBarAttached(FragmentActivity.java:
219)
at
android.support.v4.app.FragmentActivity.setContentView(FragmentActivity.java:
290)
at net.mythird.ui.notes.NoteActivity.onCreate(NoteActivity.java:
19)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
1611)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:
415)
at android.view.LayoutInflater.createView(LayoutInflater.java:
505)
... 24 more
Caused by: java.lang.NullPointerException
at
com.actionbarsherlock.internal.widget.ActionBarView.<init>(ActionBarView.java:
136)
at
com.actionbarsherlock.internal.widget.ActionBarView.<init>(ActionBarView.java:
100)
... 27 more
When launching manually in the emulator the actionbar looks exactly
like its design in layout/abs__action_bar.xml
All the values is from the debugger where I set a breakpoint at the
start of the "public ActionBarView(final Context context, AttributeSet
attrs, int defStyle)" method.
ActionBarView
- LinearLayout (ID: -1)
- RelativeLayout (ID, -1, NinePatch, actionbar_background.9.png)
- LinearLayout (ID: 2131099657) (R.id.abs__home_wrapper)
LinearLayout (ID: -1)
- ImageView (ID: 2131099663) (R.id.abs__up)
- ImageView (ID: 2131099664) (R.id.abs__home)
- LinearLayout (ID: 2131099658) (R.id.abs__actions)
- RelativeLayout (ID: -1)
- ProgressBar (ID: 2131099659) (R.id.abs__iprogress)
- FrameLayout (ID: -1)
- LinearLayout (ID: -1)
- ScrollingTextView (ID: 2131099672) (R.id.abs__action_bar_title)
- ScrollingTextView (ID: 2131099673)
(R.id.abs__action_bar_subtitle)
- Spinner (ID: 2131099660) (R.id.abs__nav_list)
- FrameLayout (ID: 2131099661) (R.id.abs__custom)
- LinearLayout (ID:2131099662,
NinePatch;abs__ab_stacked_transparent_light_holo.9.png)
(R.id.abs__nav_tabs)
At line 136 it asks for the view R.id.abs__action_bar_title.
Debugger says "R.id.abs__action_bar_title" is 2131099672
From what I see above, that is the ScrollingTextView
(R.id.abs__action_bar_title)
----------------------------------------------------------------------------------------------------------------------
When running as instrumentation test:
ActionBarView
LinearLayout (id: -1)
RelativeLayout (ID, -1, NinePatch, actionbar_background.9.png)
LinearLayout (ID: 2131099657) (R.id.abs__home_wrapper)
LinearLayout (ID: 2131099658) (R.id.abs__actions)
RelativeLayout (ID: -1)
ProgressBar (ID: 2131099659) (R.id.abs__iprogress)
FrameLayout (ID: -1)
LinearLayout (ID: -1)
ScrollingTextView (ID: 2131099672) (R.id.abs__action_bar_title)
ScrollingTextView (ID: 2131099673)
(R.id.abs__action_bar_subtitle)
Spinner (ID: 2131099660) (R.id.abs__nav_list)
FrameLayout (ID: 2131099661) (R.id.abs__custom)
LinearLayout (ID: 2131099662) (R.id.abs__nav_tabs)
(abs__ab_stacked_transparent_light_holo.9.png)
At line 136 it asks for the view R.id.abs__action_bar_title.
Debugger says "R.id.abs__action_bar_title" is 2130968600
... there is no view 2130968600.
... why has "R.id.abs__action_bar_title" that value at all? (only when
running instrumentationtests...) when running normaly, the id points
to a valid view. .
ids from the application R.java:
public static final int abs__action_bar=0x7f06001b;
public static final int abs__action_bar_container=0x7f06001a;
public static final int abs__action_bar_subtitle=0x7f060019;
public static final int abs__action_bar_title=0x7f060018;
ids from the integrationtests R.java:
public static final int abs__action_bar=0x7f04001b;
public static final int abs__action_bar_container=0x7f04001a;
public static final int abs__action_bar_subtitle=0x7f040019;
public static final int abs__action_bar_title=0x7f040018;
Why just the two 60 and 40 and all the other characters are the same?
Have to read up about how those ids are formed.
From what it looks like, its pure by coincidence if the IDS from the
original app match with the one generated in the tests project.
I removed an unsued anim folder from the application project, and that
dropped the generated values of all ids from 0x7f060xxxx; to
0x7f050xxxx;
Then I added a bogus xml folder into the test project, and put a
bogus.xml into that folder, which bumped the generated ids values in
the test project from 0x7f040xxxx; to 0x7f050xxxx;
So for now, the ids in the test and application project has been
aligned again :)
and all my tests are back running...
On 25 Nov, 17:52, Jake Wharton <jakewhar...@gmail.com> wrote:
> Are you running these tests through maven or launching through an IDE?
>
> ---
> Jake Whartonhttp://about.me/jakewharton
You may want to ask on the maven android Google Group as Manfred knows just about everything there is about how the android plugin works. He'll be able to tell you exactly what's going on and whether or not it's a bug.
---
Jake Wharton
http://about.me/jakewharton
On 6 Des, 15:09, Roberto Tyley <roberto.ty...@gmail.com> wrote:
> I'm using the android-maven-plugin (3.0.0-alpha-14) and seeing similar
> problems in my integration tests - there are some different ids in both the
> R.java files for actionbarsherlock and also the main project package.
>
> I'm guessing that Jake is right and this is in some way a problem with
> the android-maven-plugin - it's probably passing the wrong source files to
> aapt<http://developer.android.com/guide/developing/building/index.html#det...> and
> generating the wrong ids... or maybe it shouldn't be using those R files at
> all - the whole area is a bit arcane to me. Daniel, did you get any further
> with analysing the issue or have you been getting by with your workaround
> of creating matching xml folders in your integration test project?
Im using my workaround for the time. Have had no trouble with the
workaround solution.
>
> Roberto
When generating sources in integration tests project,the generated R
file contains all IDS, combined from all apklibs and dependent apks.
This R file is used by the application when running the tests.The
trouble is that this R file is not the same, and may not contain the
same IDS as the application under test.
This is because the generated R file in the integration tests also
contain IDS from resource from the the integration tests res folder,
which may have a different structure and therefor different ids.
Thats my theory, and its the android-maven-plugin that generates the R
file.
Its a bit strange, because the res folder of the integration tests
most likely never match the main application res folder in structure.
You dont put very much into the res folder of the integration tests at
all, and you would think this would be a very common problem when
using others apklibs.
As a bonus, android-maven-plugin 3.0.0 will not compile this project
before <scope>provided</scope> are set for both dependencies in
application-it/pom.xml
I set android-maven-plugin to 3.0.0-alpha-14 just to be able to show
the error message when running tests, 3.0.0 will crash even earlier
without provided-scope.
Daniel
On 9 Des, 16:22, Roberto Tyley <roberto.ty...@gmail.com> wrote:
> I modified the 'library' sub-project in maven-android-plugin-samples,
> adding ActionBarSherlock, to see if I could reproduce the problem there...
> however, all the integration tests passed without any problem:
>
> https://github.com/rtyley/maven-android-plugin-samples/commits/action...
>
> Adding additional resource folders, to disturb the generated IDs in the
> R.java files, didn't seem to cause the project to fail either, which was
> contrary to what I was expecting given daniel's workaround.
>
> However, I did notice that in the sample project, the integration test
> module includes the implementation artifact using the 'provided' scope
> (twice, once for the apk to be installed, and again to compile against):
>
> https://github.com/rtyley/maven-android-plugin-samples/blob/actionbar...
>
> I hadn't been using the 'provided' scope in my project, and I think this
> may be a factor in the problem. Perhaps critical ids are being reassigned
> new values because they're being included for a second time in the
> integration test apk?
>
> I've tried to demonstrate this by setting 'provided' scope on various
> projects, but unfortunately with varying degrees of success. Give it a try,
> see if it works for you - on the projects I've tried where it's failed, I
> think the failures may be due to unassociated bugs that I had just hitherto
> failed to encounter because of *this* issue...!
>
> Roberto
When I try to run the integration tests, every activity that has an
ActionBar crash with nullpointer i logcat.
What could this be? The application is working perfectly when started
manualy from the emulator.
[CUT]
When I try to run the integration tests, every activity that has an
ActionBar crash with nullpointer i logcat.
What could this be? The application is working perfectly when started
manualy from the emulator.
Caused by: android.view.InflateException: Binary XML file line #33:
Error inflating class
com.actionbarsherlock.internal.widget.ActionBarView
at android.view.LayoutInflater.createView(LayoutInflater.java:
[CUT]