The import android os bundle cannot be resolved

Импорт пакетов android не может быть разрешен

Мое приложение для Android, встроенное в Eclipse, внезапно не удается построить с десятками ошибок. Наиболее очевидными являются ошибки, указывающие на то, что весь импорт android не может быть разрешен.

Все они помечены как неразрешимые. Я попытался удалить и повторно добавить Системную библиотеку JRE. Я пробовал очистить и перестроить. Я попробовал параметр «Быстрое исправление» для «Исправить настройку проекта. «, но это просто отвечает диалоговым окном, которое говорит.

» Не найдено предложений для исправления неразрешимой ссылки на» android.app.Bundle «. Нажмите здесь, чтобы вручную настроить путь сборки проекта» Переключение режима молчания «.

Я новичок в разработке Android, и у меня все в тупике.

Заранее благодарим за любую помощь, которую вы можете предоставить.

ОТВЕТЫ

Ответ 1

Кажется, что ваш eclipse-workspace (или, по крайней мере, ваш Project ) каким-то образом сломан.

Вы недавно переместили свой android-sdk/Project ? Если это не проект Android, попробуйте посмотреть Preferences->Android для действительного android sdk-location .

Если это правильно, попробуйте открыть полную новую Рабочую область и импортируйте свои источники с помощью File->import->Android Project из существующего источника.

Если это все равно не поможет, создайте новый файл android Project и скопируйте источники вручную внутри Project извне Eclipse . После этого заново запустите Eclipse и создайте Project->clean

Ответ 2

Что говорили все остальные.

В частности, я рекомендую вам перейти к Project > Properties > Java Build Path > Libraries и убедиться, что у вас есть только одна копия android.jar , на которую ссылаются. (Иногда вы можете получить два, если вы импортируете проект.) И этот путь правильный.

Иногда вы можете заставить систему решить эту проблему, щелкнув другой целевой SDK в Project > Properties > Android , а затем восстановив исходный выбор.

Ответ 3

щелкните правой кнопкой мыши project- > properties- > android- > выберите целевое имя как «Android 4.4.2» —click ok

поскольку DocumentContract добавлен в API уровня 19

Ответ 4

У меня была такая же проблема после принятия обновления Java — множество ошибок сборки и импорт android не распознаны. Проверяя путь сборки в Project = > Properties, я обнаружил, что флажок для Android 4.3 каким-то образом очистился. Проверка этого разрешила все ошибки импорта, даже если мне даже не пришлось перезапускать среду IDE или выполнить проект чистым.

Ответ 5

попробуйте это в eclipse: Window — Preferences — Android — SDK Расположение и настройка пути SDK

Ответ 6

Этот import android packages cannot be resolved также возникает, когда вы используете некоторую библиотеку и эту библиотеку не в том же пути, где находится ваше приложение, или если вы импортируете библиотеку, а не копируете библиотеку в рабочую область

Читайте также:  Разработка под android только java

Ответ 7

Возможно, вы используете эту проверку:

Чтобы решить эту проблему, вам нужно импортировать класс android.provider.DocumentsContract .

Чтобы устранить эту проблему, вам необходимо установить версию SDK для сборки до 19 (4.4) или выше, чтобы иметь доступ к символам API уровня 19 при компиляции.

Сначала используйте диспетчер SDK для загрузки API 19, если у вас его еще нет. Затем настройте свой проект на использование API 19:

  • В Android Studio: Файл → Структура проекта → Общие настройки → Проект SDK.
  • В Eclipse ADT: Свойства проекта → Android → Project Build Target

Источник

Imports can’t be resolved #552

Comments

ChrisChinchilla commented Jun 18, 2015

I may be misunderstanding something, and apologies if I am.

I am running the library over a java file from an Android Studio project and I get a lot of these error messages

I understand the latter errors are to do with UI, which isn’t supported, but what about the first errors? Is this something to do with the code coming from Android Studio?

I guess I’m looking for some guidance on what needs to be removed from Java code before running j2objc and I can’t find this guidance anywhere.

I am actually writing an article on how to use the tool, so am attempting to create what is missing!

The text was updated successfully, but these errors were encountered:

kstanger commented Jun 18, 2015

j2objc needs all of your code’s dependencies on either the -sourcepath or
the -classpath. If you swap «j2objc» for «javac» in your command, you will
probably see the same errors.
You will need to have the source code for all your dependencies (excluding
core java classes) and be able to translate that source to link into your
iOS app. So you’ll have to refactor your code so that it’s free of any
dependencies that can’t be translated (such as Andoid UI).

On Thu, 18 Jun 2015 at 13:09 Chris Ward notifications@github.com wrote:

I may be misunderstanding something, and apologies if I am.

I am running the library over a java file from an Android Studio project
and I get a lot of these error messages

error: MainActivity.java:3: The import android.app cannot be resolved
error: MainActivity.java:4: The import android.content cannot be resolved
error: MainActivity.java:5: The import android.os.Bundle cannot be resolved
error: MainActivity.java:7: The import android.view cannot be resolved
error: MainActivity.java:8: The import android.view cannot be resolved
error: MainActivity.java:9: The import android.view cannot be resolved
error: MainActivity.java:10: The import android.widget cannot be resolved
error: MainActivity.java:11: The import android.widget cannot be resolved
error: MainActivity.java:20: Activity cannot be resolved to a type
error: MainActivity.java:23: Bundle cannot be resolved to a type
error: MainActivity.java:24: Window cannot be resolved to a variable
error: MainActivity.java:25: The method getWindow() is undefined for the type MainActivity
error: MainActivity.java:25: WindowManager cannot be resolved to a variable
error: MainActivity.java:25: WindowManager cannot be resolved to a variable
error: MainActivity.java:28: R cannot be resolved to a variable
error: MainActivity.java:33: AssetManager cannot be resolved to a type
error: MainActivity.java:33: The method getApplication() is undefined for the type MainActivity
error: MainActivity.java:64: Globals cannot be resolved to a type
error: MainActivity.java:64: Globals cannot be resolved
error: MainActivity.java:73: Button cannot be resolved to a type
error: MainActivity.java:73: Button cannot be resolved to a type
error: MainActivity.java:73: R cannot be resolved to a variable
error: MainActivity.java:74: View cannot be resolved to a type
error: MainActivity.java:75: View cannot be resolved to a type
error: MainActivity.java:83: Globals cannot be resolved to a type
error: MainActivity.java:83: Globals cannot be resolved
error: MainActivity.java:87: TextView cannot be resolved to a type
error: MainActivity.java:87: TextView cannot be resolved to a type
error: MainActivity.java:87: R cannot be resolved to a variable

Читайте также:  Touchpal x keyboard для андроид что это

I understand the latter errors are to do with UI, which isn’t supported,
but what about the first errors? Is this something to do with the code
coming from Android Studio?

I guess I’m looking for some guidance on what needs to be removed from
Java code before running j2objc and I can’t find this guidance anywhere.

I am actually writing an article on how to use the tool, so am attempting
to create what is missing!


Reply to this email directly or view it on GitHub
#552.

Источник

import cannot be resolved

I have an activity class with several imports but some of them are not recognized in Eclipse. I see the error import class name cannot be resolved.

That is my code:

The errors are in every import com.google.android.gms.maps. If I type another class as import android.content.Context; there are no errors.

How can I fix them?

Answer

Make sure you have the api version you are using is a Google API as well as having google play services installed

Google Play Services

Open up SDK Manager, scroll to the bottom, expand “Extras”, select “Google Play Services”, accept and download.

After this is installed, import it into the Workspace

  • Import -> Project -> Android -> Existing Android Code into Workspace , check copy to workspace and browse to where your android sdk folder is located: /extras/google/google_play_services/libproject/google-play-services_lib
  • Hit Finish

Project

  • Go to project properties, click on Android, click on Google APIs
  • Modify build path to include the recently added jar (google-play-services-lib.jar) [ located under the bin dir of the google-play-service-lib project]
  • You need to make sure that your app is registered with Google
    • Note your package name for this app
    • In order to get this registered with google, you need to verify your SHA1 certificate fingerprint under .android as debug.keystore
    • Open a cmd window (Im assuming you are working on windows) browse to C:Program FilesJava or where ever java is installed type this as a command to get the SHA1 fingerprint:
    • keytool -list -v -keystore “C:Program Files (x86)Androidandroid-sdk.androiddebug.keystore” -alias androiddebugkey -storepass android -keypass android
      • Where the quoted path (need quotes) is the path to your keystore
      • Right click hit “mark” highlight the text after “SHA1:” hit enter to copy
Читайте также:  Geometry dash full version для андроид

Google APIs Console So with the SHA1 fingerprint copied, you will need to go to https:code.google.com/apis/console

  • Under “Google apis”, click the drop down and hit “Create”, name the API project whatever you want.
    • Services should pop up now, scroll down to “Google Maps API v2 or v3” and “Google Maps Android API v2”, click the switch for one of them
    • Click on API Access on the left hand side, bringing you to a screen to “Create new Android key”
    • Remember that SHA1: fingerprint you copied? paste it in the both that comes up then ;

Go back to the project

Back in Project

Go to the AndroidManifest.xml

Add these permissions to your manifest:

Make sure instead of com.example.androidmapsv2, you match your own package name

  • Where the values is from the api console above your SHA1 fingerprint

Its a lot, i realized that, but that is how I used the maps

Источник

Bundle in Android with Example

It is known that Intents are used in Android to pass to the data from one activity to another. But there is one another way, that can be used to pass the data from one activity to another in a better way and less code space ie by using Bundles in Android. Android Bundles are generally used for passing data from one activity to another. Basically here concept of key-value pair is used where the data that one wants to pass is the value of the map, which can be later retrieved by using the key. Bundles are used with intent and values are sent and retrieved in the same fashion, as it is done in the case of Intent. It depends on the user what type of values the user wants to pass, but bundles can hold all types of values (int, String, boolean, char) and pass them to the new activity.

The following are the major types that are passed/retrieved to/from a Bundle:

putInt(String key, int value), getInt(String key, int value)

putString(String key, String value), getString(String key, String value)

putStringArray(String key, String[] value), getStringArray(String key, String[] value)

putChar(String key, char value), getChar(String key, char value)

putBoolean(String key, boolean value), getBoolean(String key, boolean value)

Using the Bundle in the Android App

The bundle is always used with Intent in Android. Now to use Bundle writes the below code in the MainActivity.

Источник

Оцените статью