Question

Right this is doing my nut and i need it solved because it keeps happening.

Basically when i go to start the app from eclipse to my phone it doesn't open, it just force closes and it's doing it because the LogCat says a resource id hasn't been found despite the fact that it does.

I've tried everything to get it to work, but just in case there's a trick I've missed, i wanted to ask you lot!

Thanks

Oh and here's the Log

  05-13 22:56:01.291: E/AndroidRuntime(27580): FATAL EXCEPTION: main
    05-13 22:56:01.291: E/AndroidRuntime(27580): Process: com.simplistic.floating_equalizerpro, PID: 27580
05-13 22:56:01.291: E/AndroidRuntime(27580): android.content.res.Resources$NotFoundException: Resource ID #0x7f070008 type #0x12 is not valid
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at android.content.res.Resources.loadXmlResourceParser(Resources.java:3231)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at android.content.res.XResources.loadXmlResourceParser(XResources.java:566)
    05-13 22:56:01.291: E/AndroidRuntime(27580):    at android.content.res.Resources.getLayout(Resources.java:1825)
    05-13 22:56:01.291: E/AndroidRuntime(27580):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.view.View.inflate(View.java:18366)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at com.simplistic.floating_equalizerpro.ui.EqualizerFragment.initUi(EqualizerFragment.java:115)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at com.simplistic.floating_equalizerpro.ui.EqualizerFragment.onViewCreated(EqualizerFragment.java:170)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:952)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:478)
05-13 22:56:01.291: E/AndroidRuntime(27580):    at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
05-13 22:56:01.291: E/AndroidRuntime(27580):    at android.support.v4.view.ViewPager.populate(ViewPager.java:1068)
05-13 22:56:01.291: E/AndroidRuntime(27580):    at android.support.v4.view.ViewPager.populate(ViewPager.java:914)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1436)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.view.View.measure(View.java:17387)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.view.View.measure(View.java:17387)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at android.view.View.measure(View.java:17387)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
05-13 22:56:01.291: E/AndroidRuntime(27580):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at android.view.View.measure(View.java:17387)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
    05-13 22:56:01.291: E/AndroidRuntime(27580):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.view.View.measure(View.java:17387)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.view.View.measure(View.java:17387)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2533)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at android.view.View.measure(View.java:17387)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2211)
    05-13 22:56:01.291: E/AndroidRuntime(27580):    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1325)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1547)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at   android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1234)
    05-13 22:56:01.291: E/AndroidRuntime(27580):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6465)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
    05-13 22:56:01.291: E/AndroidRuntime(27580):    at android.view.Choreographer.doCallbacks(Choreographer.java:603)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at android.view.Choreographer.doFrame(Choreographer.java:573)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at android.os.Handler.handleCallback(Handler.java:733)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at android.os.Handler.dispatchMessage(Handler.java:95)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at android.os.Looper.loop(Looper.java:157)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at android.app.ActivityThread.main(ActivityThread.java:5356)
  05-13 22:56:01.291: E/AndroidRuntime(27580):  at java.lang.reflect.Method.invokeNative(Native Method)
   05-13 22:56:01.291: E/AndroidRuntime(27580):     at java.lang.reflect.Method.invoke(Method.java:515)
 05-13 22:56:01.291: E/AndroidRuntime(27580):   at com.android.internal.os.ZygoteInit$Me



    protected void initUi() {
    this.mEqualizerEnabled = (CheckBox) getView()
            .findViewById(R.id.equalizer_enabled);
    this.mBandsContainer = (LinearLayout) getView()
            .findViewById(R.id.equalizer);
    this.mMaxBandLevel = EqualizerApi.getMaxBandLevelRange();
    this.mMinBandLevel = EqualizerApi.getMinBandLevelRange();
    this.mBandsCount = EqualizerApi.getNumberOfBands();
    Integer integer = (this.mMaxBandLevel - this.mMinBandLevel);
    for (int i = 0; i < this.mBandsCount; ++i) {
        inflate = View.inflate(getActivity(), R.id.equalizer_bands, mBandsContainer);
    }
    for (int j = 0; j < this.mBandsCount; ++j) {
        VerticalSeekBar verticalSeekBar = this.getBandByIndex(j);
        verticalSeekBar.setMax(integer.intValue());
        verticalSeekBar.setId(j);
    }
    for (int k = 0; k < this.mBandsCount; ++k) {
        this.getBandTitleByIndex(k).setText(
                (this.getFreqValue(EqualizerApi.getBandFreq(k))));
    }
}
Was it helpful?

Solution

These are the possible errors that I can imagine:

1- In your layout.xml you have an element like this:

  <View    
   android:id="@+id/your_id"
   android:layout_width="match_parent"
   android:layout_height="match_parent" />

But you have this instead:

  <View    
   android:id="@id/your_id"
   android:layout_width="match_parent"
   android:layout_height="match_parent" />

So... your_id element isn't added to R.java and that's the problem.

2- You're using a RelativeLayout and your doing something like this:

  <TextView
   android:id="@+id/your_id"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_centerVertical="true"
   android:layout_toLeftOf="@id/other_id"
   android:layout_toRightOf="@id/other_id2"
   android:visibility="invisible" >
  </TextView>

But other_id or/and other_id2 elements don't exist and that's the problem.

3- Maybe you're making a wrong reference, for example... calling R.id.my_layout when you should be calling R.layout.my_layout or vice versa.

Maybe I'm missing some cases but those are the problems that I can imagine so far.

If you still can't fix the problem, then you should search the resource of the error.

  1. in Eclipse, open the "gen" folder
  2. In that folder you'll see a package (com.simplistic.floating_equalizerpro I think), expand it
  3. Open the R.java file
  4. (CMD + F) or (CTRL + F) and search the id #0x7f070008
  5. Notice the resource name, you should know where in your code you used that resource... and fix it.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top