My React Native app works with import errors. I have done everything needed to fix the errors, although Android Studio still says there are errors, even though my app builds and runs successfully.
Does anyone know how to remove these false errors?
Import errors created by gradle default usually, please check your gradle.build.
Make sure you have
On some cases, you manually import the files, so check the files if you manual import the files to your project.
Maybe you need to see this tutorial to setup your gradle:
https://facebook.github.io/react-native/docs/building-from-source
Thanks.
Related
I have downloaded the CustomView.zip from developer android page.
I've tried to import this into Android Studio 2.2.0.12. But I am NOT able to do it.
I have also tried to create a empty project in order to import only the sources and XML. It does´t work either, I get a lot of duplicates XML definitions and even after resolving the duplicates the App crashes with some inflate exception.
So, i´m wondering, How can I import this into Android Studio in order to have a working project and run it to see the behavior and also to debug it
Thanks in advance.
Looking at the sample file, stupidly, it doesnt include any of the standard android framework files (gradle, manifest etc), so Android Studio will not be able to automatically import it.
To get round this you should create a new blank project, leave the mainactivity that is generated.
Then go in to the file structure of the new project and copy in the files from the sample in to the corresponding files. Make sure you overwrite the files in the new project.
Then go in to the code base in Android Studio and delete any imports that cant be found due to incorrect package names. Re import these (alt + enter on mac) with the correct package names and then build and you should be good to go.
I'm doing my best to figure out how to develop apps in Eclipse for Android Wear (I really don't like Android Studio). I have made a couple of apps so far for Android Wear in Eclipse that work perfectly fine, but I'm running into a big problem when trying to create a Watch Face.
I can't import the following:
import android.support.v7.graphics.Palette;
import android.support.wearable.watchface.CanvasWatchFaceService;
import android.support.wearable.watchface.WatchFaceService;
import android.support.wearable.watchface.WatchFaceStyle;
I have added the wearable-1.0.0.aar as a library as discussed here. I have tried adding as an external jar the "android-support-v7-appcomapt.jar" file located at "...sdk\extras\android\support\v7\appcompat\libs", but still no luck.
I am using the "Watchface" example given by google. When using it in Android Studio it works perfectly fine. The exact error I'm getting is:
CanvasWatchFaceService cannot be resolved to a type
Also, in my project under Android Private Libraries I have "classes.jar" and "android-support-v4.jar".
Does anyone have a fix? I figure it has something to do with external libraries and/or a jar I've missed.
Managed to figure it out. For anyone else who comes across this thread, the answer lies in the wearable-1.0.0 library in that it does not contain CanvasWatchFaceService. After looking through some of the other wearable projects, I found that the later versions have it. Just go to ...sdk\extras\google\m2repository\com\google\android\support\wearable. I chose the wearable-1.4.0 version.
Also, I added the external jar "android-support-v7-palette.jar" from the Android tools folder.
Now everything works perfectly for me.
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.
currently I'm trying to implement and apply a pull to refresh list view for my sample app. Now I found out about chrisbanes pull to refresh here. Yes I know it's no longer maintaned but I can't find any alternatives. Anyway I tried to read a lot of questions about importing a project and I think I'm always lost about it especially with the gradle structure.
What I tried so far is to import the project in eclipse then gradle export and copy paste it on a directory named libraries following the steps in this link. I get an error saying Cannot create class-file.
As for the other test I've done I always get a gradle error. I forgot the exact error message but most of it are because of gradle.build.
Now can anyone tell me on the steps on how I can import this project library for my Android Studio project on a step by step basis? My apologies for asking too much.
Yesterday I have created a simple android application using eclipse (ADT bundle) and when I run it, it works fine. Today, when I try to open it, it shows errors
Your project contains error(s), please fix it before running it
, and
cannot resolved variable.
After I go through my android application project, I found out that, all the import statement were gone. So I manually key in all the import statement and it works fine. This is second time I have encountered this kind of problem.Does anyone know why when I close the project and reopen it on next day, all the import statements are missing?
That shouldn't be the case usually. You can try the auto import of the library needed instead of manually inserting the library one by one by ctrl+shift+O. Another common problem is that you included the library but it still cannot reference it correctly. Something like cannot reference R.id.xxx, that can be solved by making sure that you don't have import android.R in your code.
Hope that helps :)