Можно ли удалить библиотеку android-support-v4.jar?

Когда вы создаете проект, он поставляется с этой библиотекой, добавленной по умолчанию:

поддержка android-support-v4.jar

Можно ли его удалить? Что произойдет, если я удалю библиотеку? Может ли приложение перестать работать на некоторых телефонах?

Ответы

Ответ 1

Можно ли его удалить?

Вы можете попробовать.

Что произойдет, если я удалю эту библиотеку?

Вы не сможете использовать что-либо, поставляемое им, например, бэкпорт фрагментов, ViewPager и т.д.

Может ли приложение перестать работать на некоторых телефонах?

Сначала вы получите ошибки построения.

Ответ 2

Вы можете безопасно удалить его, если вы не используете API, недоступные для текущей SDK.

Ответ 3

Если вы используете Eclipse, и ваш проект будет отмечен красным восклицательным знаком после удаления баннера android-support-v4, закройте и перезапустите Eclipse, и он должен выпрямиться. (Или вы можете попытаться просто закрыть и снова открыть проект.)

Ответ 5

Я только что сделал это. Поэтому я получаю несколько ошибок во всех проектах, например

...\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
...\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
...\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. 
...\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
...\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
...\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
...\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.

Это означает, что указанные ресурсы больше недоступны для моих проектов.

Затем я продолжил добавлять v7 appcompat, и у меня не получилось избавиться от моих ошибок. Поэтому я удалил его и по ошибке удалил проект с диска, поэтому установил остатки (я думаю), и это тоже не закончилось:

[2014-12-07 06:25:16 - android-support-v7-gridlayout] Unable to resolve target 'android-7'
[2014-12-07 06:25:16 - android-support-v7-mediarouter] Unable to resolve target 'android-17'
[2014-12-07 06:25:16 - android-support-v7-palette] Unable to resolve target 'android-7'
[2014-12-07 06:25:17 - android-support-v7-gridlayout] Unable to resolve target 'android-7'
[2014-12-07 06:25:17 - android-support-v7-palette] Unable to resolve target 'android-7'
[2014-12-07 06:25:22 - android-support-v7-mediarouter] Unable to resolve target 'android-17'


...\sdk\extras\android\support\v7\mediarouter\res\values\styles.xml:18: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.ActionButton'.
...\sdk\extras\android\support\v7\mediarouter\res\values\styles.xml:28: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.ActionButton'.
...\sdk\extras\android\support\v7\mediarouter\res\values\styles.xml:18: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.ActionButton'.
...\sdk\extras\android\support\v7\mediarouter\res\values\styles.xml:28: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.ActionButton'.
[2014-12-07 06:25:26 - android-support-v7-mediarouter] 

Так что да, НЕ ДЕЛАЙТЕ ЭТО!