diff options
author | stefan-niedermann <info@niedermann.it> | 2019-03-12 11:58:16 +0300 |
---|---|---|
committer | stefan-niedermann <info@niedermann.it> | 2019-03-12 11:58:16 +0300 |
commit | dc19bc417c4ff35ea8203bce3493dfc2e81b41bc (patch) | |
tree | 65a28048c93351244a4479e721bcf98d087c7a29 | |
parent | ef4dde7eb4f88dcbecdc6bd02ddc053ef14a96f3 (diff) |
Workaround for Resources$NotFoundException on Android 4
```
3-12 09:53:47.234 2271-2271/it.niedermann.nextcloud.deck E/AndroidRuntime: FATAL EXCEPTION: main
android.content.res.Resources$NotFoundException: File res/drawable/ic_view_column_black_24dp.xml from drawable resource ID #0x7f07007b. If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.
at android.content.res.Resources.loadDrawable(Resources.java:1928)
at android.content.res.Resources.getDrawable(Resources.java:664)
at androidx.core.content.ContextCompat.getDrawable(ContextCompat.java:479)
at it.niedermann.nextcloud.deck.ui.MainActivity.buildSidenavMenu(MainActivity.java:187)
at it.niedermann.nextcloud.deck.ui.MainActivity.access$100(MainActivity.java:45)
at it.niedermann.nextcloud.deck.ui.MainActivity$1.lambda$null$0(MainActivity.java:157)
at it.niedermann.nextcloud.deck.ui.-$$Lambda$MainActivity$1$fjUtebZdN0tro2_UplyAlWSvn7E.onChanged(lambda)
at androidx.lifecycle.LiveData.considerNotify(LiveData.java:113)
at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:131)
at androidx.lifecycle.LiveData.setValue(LiveData.java:289)
at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:33)
at androidx.lifecycle.LiveData$1.run(LiveData.java:91)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:863)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:804)
at android.content.res.Resources.loadDrawable(Resources.java:1925)
at android.content.res.Resources.getDrawable(Resources.java:664)
at androidx.core.content.ContextCompat.getDrawable(ContextCompat.java:479)
at it.niedermann.nextcloud.deck.ui.MainActivity.buildSidenavMenu(MainActivity.java:187)
at it.niedermann.nextcloud.deck.ui.MainActivity.access$100(MainActivity.java:45)
at it.niedermann.nextcloud.deck.ui.MainActivity$1.lambda$null$0(MainActivity.java:157)
at it.niedermann.nextcloud.deck.ui.-$$Lambda$MainActivity$1$fjUtebZdN0tro2_UplyAlWSvn7E.onChanged(lambda)
at androidx.lifecycle.LiveData.considerNotify(LiveData.java:113)
at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:131)
at androidx.lifecycle.LiveData.setValue(LiveData.java:289)
at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:33)
at androidx.lifecycle.LiveData$1.run(LiveData.java:91)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
```
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/MainActivity.java | 27 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_main.xml | 2 |
2 files changed, 16 insertions, 13 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/MainActivity.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/MainActivity.java index c5fdae8bb..c1baef723 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/MainActivity.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/MainActivity.java @@ -4,28 +4,29 @@ import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Bundle; -import androidx.annotation.NonNull; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.android.material.navigation.NavigationView; -import com.google.android.material.snackbar.Snackbar; -import com.google.android.material.tabs.TabLayout; -import androidx.core.graphics.drawable.DrawableCompat; -import androidx.core.view.GravityCompat; -import androidx.viewpager.widget.ViewPager; -import androidx.drawerlayout.widget.DrawerLayout; -import androidx.appcompat.app.ActionBarDrawerToggle; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.SubMenu; import android.view.View; +import com.google.android.material.floatingactionbutton.FloatingActionButton; +import com.google.android.material.navigation.NavigationView; +import com.google.android.material.snackbar.Snackbar; +import com.google.android.material.tabs.TabLayout; import com.nextcloud.android.sso.helper.SingleAccountHelper; import com.nextcloud.android.sso.model.SingleSignOnAccount; import java.util.List; +import androidx.annotation.NonNull; +import androidx.appcompat.app.ActionBarDrawerToggle; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.appcompat.widget.Toolbar; +import androidx.core.graphics.drawable.DrawableCompat; +import androidx.core.view.GravityCompat; +import androidx.drawerlayout.widget.DrawerLayout; +import androidx.viewpager.widget.ViewPager; import butterknife.BindView; import butterknife.ButterKnife; import it.niedermann.nextcloud.deck.R; @@ -75,6 +76,8 @@ public class MainActivity extends AppCompatActivity syncManager = new SyncManager(getApplicationContext(), this); stackAdapter = new StackAdapter(getSupportFragmentManager()); + AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); + //TODO replace nulls new CrossTabDragAndDrop().register(this, viewPager, null, null); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 2653e10e5..57dafac35 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -65,6 +65,6 @@ android:layout_height="match_parent" android:layout_gravity="start" android:fitsSystemWindows="false" - app:headerLayout="@layout/nav_header_main"></com.google.android.material.navigation.NavigationView> + app:headerLayout="@layout/nav_header_main" /> </androidx.drawerlayout.widget.DrawerLayout> |