Bir etkinliğe araç çubuğu eklemeye çalışıyorum. Ama bu hatayı alıyorum:Etkinliğe araç çubuğu ekleniyor NoClassDefFoundError
java.lang.NoClassDefFoundError: android.support.v7.app.ActionBarActivityDelegateBase$2
at android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor(ActionBarActivityDelegateBase.java:304)
at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:225)
at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
at com.loqooapps.Startup.Startup.onCreate(Startup.java:198)
at android.app.Activity.performCreate(Activity.java:5933)
faaliyeti Baz Aktivite uzanır ve soyut Taban faaliyeti yılında, ben ActionBarActivity uzanır.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
setContentView(R.layout.startup);
ButterKnife.inject(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if(toolbar != null) {
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("DEMO");
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
baseApp = (App) this.getApplicationContext();
yumeInterface = YuMeInterface.getYuMeInterface();
yumeInterface.setHomeView(this);
boolean bInitSuccess = yumeInterface.initYuMeSDK();
if (!bInitSuccess) {
Log.e(TAG, "Error Initializing YuMe SDK.");
}
}
public abstract class MyBaseActivity extends ActionBarActivity{...}
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:21.0.1'
compile 'com.android.support:cardview-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
Bu
benim xml geçerli:<android.support.v7 compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:21.0.1'
compile 'com.android.support:cardview-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'.widget.Toolbar
android:id compile('com.android.support:support-v4:19.1.0') {
force = true
}="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="@color/red"
android:elevation="3dp"
</android.support.v7.widget.Toolbar>
Ve bu benim styles.xml geçerli:
<!-- Base application theme. -->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowActionBarOverlay">false</item>
<item name="android:windowBackground">@null</item>
<item name="android:windowDisablePreview">false</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
değerler-V21/styles.xml:
<style name=" compile('com.android.support:support-v4:19.1.0') {
force = true
}AppTheme" parent="AppBaseTheme">
</style>
compile('com.android.support:support-v4:19.1.0') {
force = true
}
minsdk, 16 veolarak ayarlanmıştırhedef build.gradle
21 için
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:cardview-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile('com.android.support:support-v4:19.1.0') {
force = true
}
Android Manifest'e t { kuvvet = gerçek } se ('com.android.support:support-v4:19.1.0') derlemek:
<activity
android:name=".Startup.Startup"
android:screenOrientation="portrait"
android:theme="@style/AppBaseTheme"
xML hata:
java.lang.NoSuchMethodError: android.support.v4.content.ContextCompat.getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;
at android.support.v7.internal.widget.TintManager.getDrawable(TintManager.java:133)
at android.support.v7.internal.widget.TintTypedArray.getDrawable(TintTypedArray.java:62)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:249)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:191)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:396)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:100)
at com.android.tools.idea.rendering.LayoutlibCallback.loadView(LayoutlibCallback.java:176)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:132)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:117)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:802)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:400)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:708)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:697)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:697)
at com.android.tools.idea.rendering.RenderService.render(RenderService.java:816)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:646)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:82)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:589)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:584)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
W şapka verir?
Bu Samsung cihazı mı? Eğer öyleyse, bununla karşılaşmış olabilirsiniz: https://code.google.com/p/android/issues/detail?id=78377 – Karakuri
no, onun bir N5'i. Bu konuyla ilgili notları okudum ve proguard için düzeltmeyi ekledim ve proguard off ile inşa ettim. hala yok. – sirvon
@sirvon Gönderdiğiniz XML geçerli değil ve x'inizdeki kimliğiniz 'startupToolbar' ise, bu kodun aynı olduğundan emin olun 'Araç Çubuğu araç çubuğu = (Araç Çubuğu) findViewById (R.id.toolbar);'. –