How to import R into Android project? [duplicate] - java

This question already has answers here:
"R cannot be resolved to a variable"? [duplicate]
(30 answers)
Closed 9 years ago.
I've downloaded a couple of example Android projects to learn ORMLite. I constantly get this error saying R cannot be resolved to a variable. So I just do a CTRL+Shift+O to automatically import all dependencies. This then inserts import android.R; which unfortunately doesn't solve the problem.
Since the package name is com.test; I tried to do import com.test.R; but that doesn't work either.
Does anybody know how I can solve this?

try the next steps (order doesn't matter) :
update ADT & SDK , Eclipse and Java
remove gen folder , and create it again .
do a clean-project.
right click the project and choose android-tools -> fix-project-properties .
right click the project and choose properties -> java-build-path -> order-and-export. make sure the order is :
Android 4.3 (always the latest version)
Android private libraries
android dependencies
your library project/s if needed
yourAppProject/gen
yourAppProject/src
make sure all files in the res folder's subfolders have names that are ok : only lowercase letters, digits and underscore ("_") .
always make sure the targetSdk (in the manifest) is pointed to the latest API (currently 18) , and also set it in the project.properties file

Related

What does j.u.v. stand for in `java.lang.ClassCastException: j.u.v cannot be cast to kotlin.collections.MutableList` [duplicate]

This question already has answers here:
How to find the real class name from obfuscated ProGuard classname in my source code?
(1 answer)
Android - How to check Proguard obfuscation has worked?
(5 answers)
Closed 1 year ago.
I am seeing a bunch of ClassCastException crashes in my project and the stacktrace describing:
java.lang.ClassCastException: j.u.v cannot be cast to kotlin.collections.MutableList
I can't seem to figure out or find what the j.u.v. stands for.
Anyone?
I overlooked for a moment that j.u.v. of course seems to point to an obfuscated classname..
As to #RyanM question. That post you linked to there isn't that helpful for most people. This one is way better: Android - How to check Proguard obfuscation has worked?
For who wants to figure out to what class the obfuscated classname refers to you can either check the mappings.txt file in the build -> outputs -> mapping folder.
Or another way to figure out to which the obfuscated file/method name relates to is use the apk analyzer (build -> Analyze APK)

eclipse project : how to import correctly a class [duplicate]

This question already has answers here:
Eclipse: "declared package does not match the expected package", but buildpath does define the declared package
(3 answers)
Closed 5 years ago.
I'm having this issue while developing in Java using Eclipse as my IDE
I have this class path:
src\main\java\com\server\wsname\path\to
When i write "package ..." like
package com.server.wsname.path.to
it gives me this error:
The declared package "com.server.wsname.path.to" does not match the expected package "main.java.com.server.wsname.path.to"
but if i write "package ..." like:
package main.java.com.server.wsname.path.to
everything works fine.
I have the same issue with the import statement, but in this case the error message is "the import cannot be resolved."
Am i missing any configuration property in the IDE related to this?
Thanks in advance.
Right click the project, go on Configure Build Path.. and set 'java' folder as the source location.

How to get IntelliJ IDEA 2017.2 to offer suggestions on importing the right packages to resolve symbols?

How do I get IntelliJ IDEA to offer suggestions to resolve an unresolved symbol like Visual Studio does like in the picture below?
I wanted to use Aspose Cells for Java in a console application, so I downloaded the relevant JAR file and added a reference to it like so:
File -> Project Structure -> Dependencies Tab -> + sign
I am not sure why I do not see the library reference in the External Libraries node of the treeview on the left side.
Anyway, just because I wasn't sure, I also added the JAR files I needed to a newly created folder which I named lib and added that lib folder as a library like so:
Now, when I type in some code, the intellisense reports that it cannot resolve the symbol Workbook.
So, I qualify the type Workbook with its full name like so:
com.aspose.cells.Workbook and that symbols is resolved. To resolve all the symbols, I add the import com.aspose.cells.* statement on the top and the symbols are all resolved.
I was wondering why, like Visual Studio offers a suggestion for you to add the namespace on the top, does IntelliJ IDEA 2017.2 not give me suggestions to add the relevant import statement so I don't have to type it myself or even know what the correct import statement is?
Does it have such a feature? How do I use that feature?
I think you need to move the red line(Error line).
Press alt+Enter, then choose import class or(Something like this);

How can I run this android project by using eclipse? [duplicate]

This question already has answers here:
No resource found that matches the given name '#style/Theme.AppCompat.Light'
(4 answers)
Closed 6 years ago.
I want to compile and run the project (Signal-Android : Openwhisper) by using Eclipse. Is there anyway to do that? (the reason that I have to use Eclipse because of its add-on 'call graph viewer'. I want the call graph of the project. If anyone has other idea, you can post here also)
I have ADT installed already.
when I tried to run it. Lots of error appeared
No resource found that matches the given name 'Theme.AppCompat.NoActionBar'.
No resource found that matches the given name '#style/Theme.AppCompat.Light.DarkActionBar'.
No resource found that matches the given name '#style/Widget.AppCompat.ActionBar'.
... Actually it has more than 20 lines of error
Errors from Eclipse:
I found that most people using Android Studio but I cant find how to create call graph.
I tried to add Appcompat v7 as support Library but in Propertied > android > Library when I click add. It has nothing inside but I'm sure in sdk/extras/android/support/v7/appcompat/libs has v7 appcompat.jar
Check the android version you have downloaded and installed... and which version is set as target for your application...

google play apk expansion downloader library cause errors

I've imported the project on my workspace (I did't copy it) recently and got 12 errors.
This application build target is android 2.3.3.
(minSdkVersion is "9" and maxSdkVersion is "14")
The problem is I have no idea with those sort of problems.
This application is in google playstore and all i want to do is just editing some codes but
i can't even build this project. I don't know the reason why. I'm not expert on this so please give me a help.
How can i fix this?
Problems
12 errors, 25 warnings, 0 others
Errors (12 items)
error:Error:String types not allowed(at 'configChanges'with value 'orientation|keyboardHidden|screenSize').
error:Error:String types not allowed(at 'configChanges'with value 'orientation|keyboardHidden|screenSize').
NETWORK_TYPE_EHRPD cannot be resolved or is not a field
NETWORK_TYPE_HSPAP cannot be resolved or is not a field
NETWORK_TYPE_LTE cannot be resolved or is not a field
Notification.Builder cannot be resolved to a type
Notification.Builder cannot be resolved to a type
The container 'Android Dependencies' references non existing library'/Users/Downloads/Folder/downloader_library/bin/downloader_library.jar'
The project cannot be built build path errors are resolved
TYPE_BLUETOOTH cannot be resolved or is not a field
Type_ETHERNET cannot be resolved or is not a field
The library is not found:
The container 'Android Dependencies' references non existing library'/Users/Downloads/Folder/downloader_library/bin/downloader_library.jar'
Make sure the path is correct.
Whatever project have you imported, but within it, you missing one external library which is attached with that project, so you must need to include it first,because the reason of your errors are, some classes of that external library is used in your project, I think that is the only reason. Have you added that library or not?

Categories

Resources