bug?
opened this issue · comments
First of all, thank you for your work.
I'm a student and I'm making an app for college.
Everything was fine, but for a few days, I get the following error ... I do not know why ...
Thank you!!!
05-22 10:12:43.653 25307-25307/es.urjc.mov.vromero.spacetab E/AndroidRuntime: FATAL EXCEPTION: main
Process: es.urjc.mov.vromero.spacetab, PID: 25307
java.lang.RuntimeException: Unable to start activity ComponentInfo{es.urjc.mov.vromero.spacetab/es.urjc.mov.vromero.spacetab.MainActivity}: android.view.InflateException: Binary XML file line #14: Binary XML file line #14: Error inflating class eu.long1.spacetablayout.SpaceTabLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: android.view.InflateException: Binary XML file line #14: Binary XML file line #14: Error inflating class eu.long1.spacetablayout.SpaceTabLayout
Caused by: android.view.InflateException: Binary XML file line #14: Error inflating class eu.long1.spacetablayout.SpaceTabLayout
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143)
at es.urjc.mov.vromero.spacetab.MainActivity.onCreate(MainActivity.java:20)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NoSuchFieldError: No field fab of type I in class Leu/long1/spacetablayout/R$id; or its superclasses (declaration of 'eu.long1.spacetablayout.R$id' appears in /data/app/es.urjc.mov.vromero.spacetab-1/split_lib_slice_3_apk.apk)
at eu.long1.spacetablayout.SpaceTabLayout.init(SpaceTabLayout.java:143)
at eu.long1.spacetablayout.SpaceTabLayout.(SpaceTabLayout.java:122)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143)
at es.urjc.mov.vromero.spacetab.MainActivity.onCreate(MainActivity.java:20)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Sorry.. this is my code:
--------------------------Layout-------------------------------------------
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="56dp" />
<eu.long1.spacetablayout.SpaceTabLayout
android:id="@+id/spaceTabLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_behavior="eu.long1.spacetablayout.SpaceTabLayoutBehavior"
app:number_of_tabs="three"
app:starting_position="one"
app:button_color="@android:color/holo_red_dark"
app:text_one=""
app:text_two=""
app:text_three=""
app:icon_one="@android:drawable/ic_menu_add"
app:icon_two="@android:drawable/ic_menu_add"
app:icon_three="@android:drawable/ic_menu_add"/>-->
</android.support.design.widget.CoordinatorLayout>
---------------------------------------------------------------------MainActivity-------------------
package es.urjc.mov.vromero.spacetab;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import java.util.ArrayList;
import java.util.List;
import eu.long1.spacetablayout.SpaceTabLayout;
public class MainActivity extends AppCompatActivity {
SpaceTabLayout tabLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//add the fragments you want to display in a List
List<Fragment> fragmentList = new ArrayList<>();
fragmentList.add(new FragmentA());
fragmentList.add(new FragmentA());
fragmentList.add(new FragmentA());
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
tabLayout = (SpaceTabLayout) findViewById(R.id.spaceTabLayout);
//we need the savedInstanceState to get the position
tabLayout.initialize(viewPager, getSupportFragmentManager(),
fragmentList, savedInstanceState);
}
//we need the outState to save the position
@Override
protected void onSaveInstanceState(Bundle outState) {
tabLayout.saveState(outState);
super.onSaveInstanceState(outState);
}
}
You have "-->" at the end of the "<eu.long1.spacetablayout.SpaceTabLayout> tag.
If it is because I was doing tests, but if I delete it happens the same
did you copy the source or used gradle dependency?
It's very strange it worked out well for me this month and on Friday I got this bug and it does not load anything
-----APP------
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "es.urjc.mov.vromero.spacetab"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'eu.long1:spacetablayout:1.0.4'
testCompile 'junit:junit:4.12'
}
-----PROJECT-----
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
try to clean the project and try again. Open the terminal in the root folder and type gradle clean then hit enter. What version of Android Studio do you have?
I just tried with version 1.0.3 and everything ok !!
glad, have a good day
Already tried clean project but nothing
Ok , thank you!!!!