Can not find the symbol R in running androidTests - android

I am trying to clone and run this project.
Catroid
I am unable to run the tests inside androidTests.
I have previously written tests for my project, but I can't seem to understand the problem with this one.
The steps I am following are:-
Cloning the repository.
Opening it in android studio,The app is running completely fine.
But when I try to run the tests(androidTests), It gives following errors:
Error:Can Not find the symbol R
Error:package R does not exist,and gives 72 such errors
One of those lines which is causing this error is this
Error Line
I have manually checked, R.java file for test resources is there in the project
This is the google group thread of the same
Google Group Discussion
I have tried cleaning, rebuilding, invalidating the cache, restarting.
I dont know what i am missing
ScreenShot of Error Message.

Related

Flutter Build Apk Error "Unresolved reference: snackbar"

I'm currently making an e-commerce project using flutter. I need a payment gateway to make transactions, so I install the "stripe_payment" package (https://pub.dev/packages/stripe_payment).
After I followed the installation steps, I run the "flutter run" command. The result is the package stripe can run well in my application.
However, when I run the "flutter build apk", an error appears as below:
The main errors are:
e: C:\Users\samue\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\stripe_payment-1.0.5\android\src\main\kotlin\de\jonasbark\stripepayment\StripeDialog.kt: (6, 36): Unresolved reference: snackbar
When I open the C:\Users\samue\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\stripe_payment-1.0.5\android\src\main\kotlin\de\jonasbark\stripepayment\StripeDialog.kt file and I check line 6, I see inside the file importing import com.google.android.material.snackbar.Snackbar.
Then I looked for a solution on google, it looks like the problem is build.gradle. Here I attach the contents of the file from build.gradle
But I tried editing the build.gradle dependencies section that I got from Google, but all of them didn't work. When I run the flutter build apk, the same error still appears.
I have found the solution. I deleted the package "search_widget", then the package "stripe_payment" can run normally again without any errors during the build.
From this problem, I just understood that there are possibilities that packages on flutter can conflict, causing errors.

Gradle Build : error package does not exist

I was developing an android app (using Eclipse, not Studio) following some example, which makes use of Github/CircleImageView. Hence, I wanted to compile that first into a jar library.
So on my Linux machine I installed gradle and since its my first time with gradle, I followed the tutorial on gradle. So, in the root directory of the project ~/Downloads/CircleImageView-master/, I :
Run gradle wrapper. Got Build Success
Run ./gradlew build, gives the following error
CircleImageView.java:21: error: package com.nineoldandroids.animation does not exist
import com.nineoldandroids.animation.ObjectAnimator;
Though, I can see that there is one jar file in the project ~/Downloads/CircleImageView-master/circleimageview/libs/nineoldandroid-library-2.4.0.jar. Can anyone please help in resolving the issue. I am trying since past 10 hours and reached so far here after resolving all the issues, and stuck just at the last point.
I opened the jar in a package manager and the required classes are there, including ObjectAnimator.

android studio cannot resolve symbol R [duplicate]

This question already has answers here:
"cannot resolve symbol R" in Android Studio
(100 answers)
Closed 7 years ago.
I've been working on an app and all was going well, everything was working fine. Then I modified some code in my main activity, and when I tried to run the app, there was an apparent error in my code and the build failed.
After this, all the references to my layout files were no longer working (i.e., R.layout.) R was red and hover over says "Cannot resolve symbol R".
Searching you will find dozens of posts that propose many fixes, like: Clean Project; Rebuild Project; Sync Project with Gradle Files; Invalidate Cashes / Restart; Check xml for errors, restart Studio, etc... I've tried them all.
NONE OF WHICH WORK IN MY SITUATION.
My code is working and without errors because I can create a new Android Studio project, and add my classes and resources. The new Android Studio project will run the the SAME CODE under a different package name.
I encountered this same problem a while back and I vaguely remember deleting something from my project folder (might have been a folder or file). I don't remember what I deleted, but it did fix the problem.
Thanks for any advice.
I finally got Android Studio to build without errors, but honestly I don't know how this happened. It was very puzzling that I could have a project that worked and several copies that didn't (I must have re-created my project 10 times from scratch) each time I would copy the project to an archive directory and start over. One of my build requirements was I needed to compile on Jelly Bean, and I think Android Studio sets some sort of defaults when you open a new project with a Blank Activity. Anyway, each time the R. error occurred the build warning would display this:
<style name="Base.Widget.AppCompat.Spinner.Underlined" parent="android:Widget.Material.Spinner.Underlined
But my code does not contain a spinner, so I really can't figure out where this is coming from. In fact I've tried to replace files in one of my inoperable saved projects with the files from my working copy (manifests, code, gradle.build, etc.) yet once inoperable, it seems a Studio project will remain that way.
I wish I could reproduce the problem but I cannot.
WTF! After thinking I had resolved this the problem, it is back again. From my working project I did 2 things. Added a very simple activity, and added it's reference to the manifest. Tried to run the project and get the SAME error again, referencing the a spinner. The Gradle build message is:
C:\CargoBay\Android\LandApp\app\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml
Error:(3) Error retrieving parent for item: No resource found that
matches the given name 'android:Widget.Material.Spinner.Underlined'.
I removed the new code from my project, and it still won't build.
I don't know what to think now.
In Android Studio select your project folder, go to VCS / Local History / Show History. Show History will list any files that were moved or deleted, and give you an option to restore the file.
If you select your main activity code, it shows the history of code changes, and you can restore to previous code that was working.

Getting error on every newly created project

Whenever I create a new project in Eclipse for some Android application it gives me a red cross sign and on compiling shows following errors:
error generating final archive: java.io.FileNotFoundException: C:\..\bin\resources.ap_ does not exist
Unparsed aapt error(s)! Check the console for output.
On Googling I found that by cleaning the project we can remove this error but it is not working in my case.
Earlier I was able to create Project in Eclipse. All this problem started after installing some Google APIs but I guess they are not cause of problem, something else is there.
Could it be an issue with a command path?
SDK doesnt like being installed in dirs with long names like "Program Files\Google\Android..."
If thats the case, youll need to adjust path appropriately (C:\Progra~2... or smth like this)
( check http://ideanotion.net/android-sdk-invalid-command-line-parameter-files-error/ or Google )

Android error not visible

When I attempt to run my Android application I get the following message:
your project contains error(s), please fix them before running your application
All I did was to clean the application and everything went wrong.
Normally, you would see a red asterisk against the offending file and the corresponding line with the error. But in this case I get no such indication.
Screenshots:
Sounds like you have a syntax error in one of your XML files, or an invalid file name.
When you do a clean it deletes certain files, it would then automatically build, if you have syntax errors the R.java file won't be generated and you will have the above error.
you can check in android console(window->show view->console),it will give some more information,check it once,check your build path if your are import your project somewhere else and the project uses 3rd party libraries or you may have problems with your XML resources.
Found the source of my mysterious error.
It turns out it was a imported java class I had forgotten about which I wasn't using and caused the error to showup when I "cleaned" the project.
I visited the build path where I saw it had an associated error. I removed it and all was well.

Categories

Resources