I am following a Google's tutorial and I've added the following to my project:
compile 'com.firebase:firebase-jobdispatcher:0.8.5'
But when I attempt to import anything from this package, it's like it wasn't even compiled/implemented at all. I tried rebuilding and cleaning the project, erasing the line in gradle, syncing, adding it to gradle again and syncing again but nothing changes.
According to the tutorial, the Driver class belongs to com.firebase.jobscheduler.Driver, but as shown in the image, it isn't there.
Did I forget something? I saw no different action to import this package.
Related
I have implemented com.google.android.gms:play-services:12.0.1 in my new project. It shows an error after I have synced the gradle.
Then I implemented com.android.support:palette-v7:28.0.0-rc02 from project structure. It was okay after that. When I did that to media-router, It didn't work. It showed a dialog that I need to download it but after downloading nothing is happening.
What I have done:
I tried looking in the build.gradle but the error is still there.
I tried to import it again but it just prompted me again to download, then same thing happened.
What you are seeing is not an error, it's a warning. You can still compile and run your app. But it is recommended by google to keep all support libraries of the same version to avoid runtime crashes.
I'm using CSipSimple. I followed the migration guide from Eclipse to Android Studio carefully and the only error that I am getting is
cannot resolve symbol utils
and is happening on below lines:
import com.actionbarsherlock.internal.utils.UtilityWrapper;
import com.csipsimple.R;
In build.gradle, I have added the following line:
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:19.0.+'
}
Does anyone know why this would be happening? Any suggestion will be of great help.
ActionBarSherlock-4.4 does not have the package utils.
Check the version that was used before migrating to Android Studio.
VenomVendor's answer already provides the reason: there's no UtilityWrapper on ActionBarSherlock. So, I'll try to provide the fix instead.
tqcenglish has a GitHub repo for Android Studio port for CSipSimple. Its readme says:
Change
/res/values/wizard_sipgate_string.xml
<string xm:lns:ns0="http://schemas.android.com/tools" /> -
<resources xmlns:ns0="http://schemas.android.com/tools"/> +
delete jni folder
add jniLibs folder and org.pjsip.pjsua to java folder
delete about quote UtilityWrapper
Reference
com.actionbarsherlock:actionbarsherlock:4.4.0#aar
This seems to give a hint of removing any reference to UtilityWrapper, including import com.actionbarsherlock.internal.utils.UtilityWrapper;. However, it might compromise something.
You're on the right path to use com.actionbarsherlock:actionbarsherlock:4.4.0#aar for the dependency.
Alternatively, I don't see any reasons why files under utils won't work outside of com.actionbarsherlock.internal package, so you should be able to copy all files from com.actionbarsherlock.internal.utils to your java folder, then replace the import statement to use the corresponding package.
If you get this error while trying to use OpenCV, import this:
import org.opencv.android.Utils;
I am trying to install zxing in android studio but i am running into some trouble. I have looked around at lots of different posts and tutorials and they have all said to just add the following lines into the build.gradle dependencies
compile 'com.google.zxing:core:3.1.0'
compile 'com.google.zxing:android-integration:3.1.0'
I have done this and synced everything but when I try and add an import like
import com.google.zxing.integration.android.IntentResult;
at the top of my project it instantly disappears without an errors or warning.
Has anyone else had this problem or know what I am doing wrong?
Your IDE will remove the import if you have some auto-cleaning unused import statements. It depends on the IDE to configure this option but both Android Studio and Eclipse have this feature.
I suggest you to start using this IntentResult and then it will keep the import statement.
I am getting error when i want to import google-play-service in Eclipse.
i have import google-play-service-project-lib in Eclipse
i have read all possible Q&A but nothing is work.
I have it added as Library and JAR manually
Then I have tried to clean my project ...
Is there anybody who can solve this problem?
You can use this way. First of all close projects which are using google-play-services library. Whenever your mouse over the com.google.android.gms import that can not be resolved and towards the bottom of the popup menu, select the "Fix project setup" option as below. Then it'll prompt to import the google-play-services library.
Firstly, try to download latest version of Google Play Services, then:
Remove the existing library to add again manually,
Go to your java build path,
Under project tab add your library and then,
Under order & export tab tick your library,
Apply settings.
After all, just clean the project and library, it should work.
By the way, you can also check this question.
To me it was just a matter of updating the dependencies.
dependencies {
implementation 'com.google.android.gms:play-services-ads:20.6.0'
}
I concluded that if it's already on the latest version, refresh the Gradle may solve the issue - or, as already recommended by Umit Kaya, remove the existing library and add it back.
I have followed the procedure as described here : Setup
I have clicked on the little 'Sync project with Gradle' button. Gradle and Android Studio seem to find everything but then I can't actually use the gms code. If I try to import, I will get autocomplete for com.google.android.gms but no further. I have updated all the packages with Android SDK Manager.
I'm running Android Studio 0.4.2.
My minSdk is set to 9
my build.gradle includes compile 'com.google.android.gms:play-services:4.0.30'
As far as the procedure is concerned I should be ready to code, but it just doesn't work. Any ideas?
[Edit, added info]
I can find the ComGoogleAndroiddGmsPlayServices3265.aar file in my exploded bundles directory. Inside of that file I also find the common directory and inside that I find the GooglePlayServicesUtil.class (which is what's not being found in my app)
I am lost.
[Edit 2]
The problem is not specific to Google Play Services OR Android Studio. I tried adding another library (HoloColorPicker) and had the same results. However, I was able to add the library's resources to my project! I was able to add them in my XML layouts and view them in my application. I was able to interact with them, they worked fine. The problem arose again when I tried to reference them in the code. Exactly like the case with gms, I had code completion when trying to import up to the point of the actual class, and I could not declare the class in the code.
I was able to use the library by cloning it and importing the project.
Also, this is not an Android Studio problem because the same thing happens on the command line with "./gradlew clean build"
This is a current bug in Android Studio: https://code.google.com/p/android/issues/detail?id=64508 to be fixed this week.
The workaround is to close the project, delete the .iml files and .idea project and re-import the project.
Keep Your compile 'com.google.android.gms:play-services:4.0.30' as very first line in build.gradle dependencies like
dependencies {
compile 'com.google.android.gms:play-services:4.0.30'
compile 'com.android.support:support-v4:18.0.+'
compile 'com.android.support:appcompat-v7:+'
}
`
Open File> Project Structure and do the following steps
Select your main module in which you want to add dependency and click on OK.
Now try to import.
I think the most important question is what you want to achieve. Not all code is under this package. Not even sure which one is.
As noted before, this is a bug with Android Studio. It just don't recognize the path for classes and shows you like if there is an error. If you try compiling you'll see that everything just work fine.
A googler recently said it'll be addressed in this week release, so, be patient and lets see whats coming.
The fact that AS is in Preview mode tell us this sort of things are going to happen :)
Android studio is crazy one, I think.
It's removed "Import module" function and you can do "New module" only.
If you are developed on Eclipse, you need export all your projects to Gradle before switch to Androids studio (WTF?)
I prefer "IntelliJ IDEA Community Edition", although It's similar Android studio but it's better than Android studio (at least until now). You just import your project as eclipse format, IntelliJ IDEA will detect dependences libraries automatic (May be you need import jar libraries by hand) and rebuild project. That Done.