相关疑难解决方法(0)

android.view.InflateException:二进制XML文件:错误膨胀类片段

我有一个非常令人沮丧的错误,我无法解释.我创建了一个Android应用程序,用于Android AppCompat使其与旧版本兼容.这是我的主要活动布局文件:

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <!-- As the main content view, the view below consumes the entire
         space available using match_parent in both dimensions. -->
    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- android:layout_gravity="start" tells DrawerLayout to treat
         this as a sliding drawer on the left side for left-to-right
         languages and on the right side for right-to-left languages.
         If you're not building against API 17 or higher, use
         android:layout_gravity="left" instead. -->

    <!-- The drawer is given …
Run Code Online (Sandbox Code Playgroud)

android

143
推荐指数
10
解决办法
34万
查看次数

扩展类android.support.v7.internal.widget.ActionBarView时出错

我的应用程序正在运行,但是当我今天上午开始处理它时,一切都无法正常工作.我收到一个错误膨胀类错误,似乎是从一个xml文件,我得到"二进制XML文件行#25"行.正如我所说,这工作正常,现在突然间没有.以下是异常跟踪:

01-27 11:20:53.624: E/AndroidRuntime(7831): FATAL EXCEPTION: main
01-27 11:20:53.624: E/AndroidRuntime(7831): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ypmmllc.dailychecklist/com.ypmmllc.dailychecklist.TabbedActivity}: android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.internal.widget.ActionBarView
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2737)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2753)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.access$2500(ActivityThread.java:129)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2107)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.os.Looper.loop(Looper.java:143)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.main(ActivityThread.java:4701)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at java.lang.reflect.Method.invokeNative(Native Method)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at java.lang.reflect.Method.invoke(Method.java:521)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-27 11:20:53.624: E/AndroidRuntime(7831): …
Run Code Online (Sandbox Code Playgroud)

android android-xml

6
推荐指数
1
解决办法
1万
查看次数

actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS)已弃用

我正在按照教程https://www.youtube.com/watch?v=VVahIc8yENk进行操作,我收到了错误消息

java.lang.NullPointerException:尝试在空对象引用上调用虚方法'void android.app.ActionBar.setNavigationMode(int)'

我正在使用Android Studio编写这个程序,我已经尝试从API 11到21,但没有一个工作.

public class Tabtest extends FragmentActivity implements ActionBar.TabListener {

    ActionBar actionBar;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tab_test);

        actionBar=getActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        ActionBar.Tab tab1=actionBar.newTab();
        tab1.setText("tab1");
        tab1.setTabListener(this);

        ActionBar.Tab tab2=actionBar.newTab();
        tab2.setText("tab2");
        tab2.setTabListener(this);

        ActionBar.Tab tab3=actionBar.newTab();
        tab3.setText("tab3");
        tab3.setTabListener(this);

        ActionBar.Tab tab4=actionBar.newTab();
        tab4.setText("tab4");
        tab4.setTabListener(this);

        actionBar.addTab(tab1);
        actionBar.addTab(tab2);
        actionBar.addTab(tab3);
        actionBar.addTab(tab4);
    }

    @Override
    public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
        Log.d("VIVZ", "onTabReselected at "+" position "+tab.getPosition()+" name "+tab.getText());
    }

    @Override
    public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
        Log.d("VIVZ", "onTabReselected at "+" position "+tab.getPosition()+" …
Run Code Online (Sandbox Code Playgroud)

java android

6
推荐指数
2
解决办法
2万
查看次数

多个dex文件定义Landroid/support/v4 /

我无法编译项目得到以下错误编译:

错误:任务':myApp:dexDebug'的执行失败.

com.android.ide.common.internal.LoggedErrorException:无法运行命令:C:\ Program Files文件(x86)的\ Android的\ Android的工作室\ SDK \构建工具\ 21.0.2\dx.bat --dex - 输出C:\用户\ Android Studio中\ Android Studio中\对myApp \建立\中间体\ DEX \调试--input列表= C:\ Users \用户对myApp \下载\ Android Studio中\ Android Studio中\对myApp \建立\中间体\ TMP\DEX \调试\ libraryList.txt错误代码:2输出:意外的顶级例外:com.android.dex.DexException:多DEX文件定义Landroid /支持/ V4/accessibilityservice/AccessibilityServiceInfoCompat $ AccessibilityServiceInfoVersionImpl; 在com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)

当然,这段代码解决了我的问题

configurations { all*.exclude group: 'com.android.support', module: 'support-v4'

但不幸的是不满足我

dependencies {
    compile fileTree(include: '*.jar', dir: 'libs')

    compile 'com.android.support:support-v4:21.+'
    compile project(':PullToRefreshListFragment')
    compile project(':validator')
    compile project(':AndroidBootstrap')

    compile 'com.google.android.gms:play-services:6.+'
    compile 'com.android.support:appcompat-v7:21+'

    compile 'com.github.codechimp-org.apprater:library:1.0.+'
    compile 'com.sothree.slidinguppanel:library:+'
    compile 'me.grantland:autofittextview:0.2.+'
    compile 'io.realm:realm-android:0.71.0'

    compile ('com.loopj.android:android-async-http:1.4.6')
    {
        exclude group: 'com.google.android', module: …
Run Code Online (Sandbox Code Playgroud)

android gradle android-manifest android-support-library android-studio

2
推荐指数
1
解决办法
1万
查看次数