致命异议:主要组合项目

时间:2018-01-22 09:30:24

标签: java android android-studio

嗨,这个错误总是弹出我的应用程序我只是试图将我们的作品差异项目合二为一,但它似乎有一个问题。

我尽我所能,但我无法解决我的问题我是一个新手Android应用程序开发人员我们正在让我们的论文项目下个月传递我希望你能帮助我这么多。

这是我的logcat

    01-22 17:21:57.659 21340-21340/innotech.inlearn E/AndroidRuntime: FATAL EXCEPTION: main
                                                                  Process: innotech.inlearn, PID: 21340
                                                                  java.lang.OutOfMemoryError: Failed to allocate a 58982412 byte allocation with 4182376 free bytes and 51MB until OOM
                                                                      at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
                                                                      at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                                                                      at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:655)
                                                                      at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:483)
                                                                      at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1157)
                                                                      at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:794)
                                                                      at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:645)
                                                                      at android.content.res.Resources.loadDrawable(Resources.java:976)
                                                                      at android.content.res.TypedArray.getDrawable(TypedArray.java:931)
                                                                      at android.view.View.<init>(View.java:4274)
                                                                      at android.widget.TextView.<init>(TextView.java:737)
                                                                      at android.widget.Button.<init>(Button.java:109)
                                                                      at android.widget.Button.<init>(Button.java:105)
                                                                      at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:71)
                                                                      at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:67)
                                                                      at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:109)
                                                                      at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024)
                                                                      at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081)
                                                                      at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:192)
                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:769)
                                                                      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 innotech.inlearn.tab1Home.onCreateView(tab1Home.java:20)
                                                                      at android.support.v4.app.Fragment.performCreateView(Fragment.java:2354)
                                                                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419)
                                                                      at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
                                                                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
                                                                      at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)
                                                                      at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580)
                                                                      at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)
                                                                      at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)
                                                                      at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2199)
                                                                      at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:651)
                                                                      at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:145)
                                                                      at android.support.v4.view.ViewPager.populate(ViewPager.java:1236)
                                                                      at android.support.v4.view.ViewPager.populate(ViewPager.java:1084)
                                                                      at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1614)
                                                                      at android.view.View.measure(View.java:20132)
                                                                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6282)
                                                                      at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:714)
                                                                      at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:91)
                                                                      at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1361)
                                                                      at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:784)
                                                                      at android.view.View.measure(View.java:20132)
                                                                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6282)
                                                                      at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
01-22 17:21:57.660 21340-21340/innotech.inlearn E/AndroidRuntime:     at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
                                                                      at android.view.View.measure(View.java:20132)
                                                                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6282)
                                                                      at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
                                                                      at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
                                                                      at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
                                                                      at android.view.View.measure(View.java:20132)
                                                                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6282)
                                                                      at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
                                                                      at android.view.View.measure(View.java:20132)
                                                                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6282)
                                                                      at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
                                                                      at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
                                                                      at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
                                                                      at android.view.View.measure(View.java:20132)
                                                                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6282)
                                                                      at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
                                                                      at com.android.internal.policy.DecorView.onMeasure(DecorView.java:714)
                                                                      at android.view.View.measure(View.java:20132)
                                                                      at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2640)
                                                                      at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1577)
                                                                      at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1846)
                                                                      at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1462)
                                                                      at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6965)
                                                                      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:907)
                                                                      at android.view.Choreographer.doCallbacks(Choreographer.java:709)
                                                                      at android.view.Choreographer.doFrame(Choreographer.java:644)
                                                                      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:893)
                                                                      at android.os.Handler.handleCallback(Handler.java:836)
                                                                      at android.os.Handler.dispatchMessage(Handler.java:103)
                                                                      at android.os.Looper.loop(Looper.java:203)
                                                                      at android.app.ActivityThread.main(ActivityThread.java:6361)
                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)

1 个答案:

答案 0 :(得分:0)

尝试添加:

 android:largeHeap="true"
AndroidManifest.xml 文件中的

。你得到的东西看起来像是:

<application
    android:allowBackup="true"
    android:hardwareAccelerated="false"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">