Gradle Build : error package does not exist - android

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.

Related

Auto Package Duplication in Test Directory of Android Studio

I was preparing some tests for my module in android studio and everything was working fine, but yesterday when I opened my project again, I found an auto-generated copy of my test package.
when I tried to delete it, my original package got deleted with it.
today I tried to create a package again and the problem is still persisting, and it is only occurring in the "tests" folder
structure at Android level: Duplicate at Android level
structure at Project level: only one package at Project level
I found a similar question here but it defers a bit: link
he found the problem was due to one of his dependencies which were auto-generating the code, but my project structure was fine for a week, the problem occurred just recently. and I've hard-coded the dependency versions so there's no way it might have happened due to an update.
Although Just in case, This are my dependencies:
Does anyone have any idea why this is happening?

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.

IntelliJ can't build Gradle project due to missing libraries

A while back I started a project that uses libgdx. It supports all platforms so I have a module for each in my project structure. The project worked for a long time and then I updated a few things in the IDE (I don't know what, I just accepted the updates) and nothing would build or run. Since I hadn't really made any changes I backed up my project folder, deleted it, checked out the project from github and tried to start over. Unfortunately no.
Every time I build the project I get this error:
Error:Android Gradle Build Target: java.lang.NoClassDefFoundError: com/android/utils/ILogger
When I go to file > project structure > Modules > android > dependencies the following libraries are all missing classes:
appcompat-v7-25.3.1
support-compat-25.3.1
support-v4-25.3.1
support-core-ui-25.3.1
support-core-utils-25.3.1
support-fragment-25.3.1
support-media-compat-25.3.1
support-vector-drawable-25.3.1
animated-vector-drawable-25.3.1
According to the IDE they are all supposed to be located in:
PROJECTDIR\android\build\intermediates\exploded-aar\com.android.support\LIBNAME
but \exploded-aar\ doesn't exist.
I have spent the whole day searching and trying different solutions to no avail so I don't even know if this is the problem. Any help is much appreciated.
There is an open bug logged for this problem. Please follow for updates.

Intellij IDEA 14 - Package R does not exist

Well, I recognize that this has been asked before, but in browsing the other answers:
IntelliJ IDEA - Can't build anything, always get "package R does not exist"
Error: java: package R does not exist
etc.
none of the solutions work.
This is for a project that was building fine until at least the last couple days, so whatever is causing the problem must be new.
Symptoms:
Attempting to to a Build > Rebuild Project fails. I see the step for compiling generates sources go by in the status bar, but the next compilation step fails with the dreaded "java: package R does not exist."
R is found just fine in the IDE, so only compilation fails, suggesting there is a problem with the compilation of the generated sources. This seems borne out by the fact that in the out/production/[module] directory, only some resource files show up, no compiled classes, nothing in the "generated" sbupackage, a no apk file.
Interestingly, when I connect my phone to the computer and try running the application on the device, new changes are picked up, so something is being successfully built somewhere.
Things I've tried:
Per the other threads I've tried:
Doing a full rebuild.
Restarting IntelliJ (including with invalidating caches)
Restarting the computer.
Checking that the gen package is included under sources.
Checking for any Excludes (there are none)
Deleting the stub R file and forcing IntelliJ to regenerate it (which it does promptly)
Confirming that there is an Android facet on the module.
Double-checking that the manifest xml file has not changed and that the referenced activity is correct.
Checked that exclude output path is not checked (it's greyed as I'm inheriting from the project compile path, but I tried switching and manually unchecking it... no luck).
The only recent changes in xml were:
A new item in a menu file. I tried removing it to see if somehow that was an issue even though there were no errors reported, but the problem persisted.
I moved a View class to a subpackage of its prior package. That View class is referenced once in a layout xml and I confirmed that the xml was updated with the new package name.
So at this point I'm out of ideas. Sorry to rehash a somewhat common question.
I have the same problem and it definitely related to last update of the IDE. My version is IU-139.1117.1
Before the update Build -> 'Rebuild Project' was working ok in a windows and a mac installation of the IDE. I updated windows first and 'Rebuild Project' shows the error 'Package R does not exist' even for a new Android project. Same error apeared in mac installation imediately after the update. 'Make project', 'Make module' and 'Compile' commands on the Build menu are all working ok with no error only 'Rebuild project' raises the error.
For a new Gradle Android project everything works ok. It seems something is wrong with last update.
It is reported issue in IDEA 14.0.3 (http://youtrack.jetbrains.com/issue/IDEA-135234).
You can try to Compile Module (Ctrl-Shift-F9) for the module that contains missing R file. It works for me (but I have to do this every time i add/remove items in resources).
don't use Rebuild Project, use Make Project and refresh your project,maybe you should try it a few more times.
Try File | Invalidate Caches. This is solve my problem.
If you cannot wait for a officially stable build, install IDEA EAP 14.0.4 (IntelliJ IDEA 14.0.4 EAP build 139.1408, released on February 20th, 2015) from https://confluence.jetbrains.com/display/IDEADEV/IDEA+14+EAP
I've just solved all issues and rebuild project works again.
Solved with the 14.1 update of intelliJ IDEA, available now.
I had the same issue on a Windows 7 box today with a Java 7 Gradle project, using IntelliJ 14.1.5.
The problem was that somehow the classpath was "too long", but IntelliJ gave me only those strange "java: package foo does not exist" compile error's.
The usual tricks (see also above) did not help.
The workaround was to shorten the classpath a bit, in my case setting GRADLE_USER_HOME to c:/.gradle (was before c:/users/myusername/.gradle). After resyncing the gradle project everything worked fine.
The problem was therefor obviously IMO some kind of windows filesystem path length restriction.

SignalR in Android Studio

I'm trying to make use of SignalR in Android Studio and while it apparently has added the projects and dependencies to my application project I'm getting constant
Error:(11, 39) error: package microsoft.aspnet.signalr.client does not exist
The import for these packages was dynamically added by Android studio as I started typing code to make use of it
Platform.loadPlatformComponent(new AndroidPlatformComponent());
So there is something there.
However when I try and actually build my main project I keep getting the package error.
I've run out of ideas now as to why it can know enough about the project to build it and reference the packages but then not actually find those packages for the main project to use.
Any ideas?
I never did find out how to do it via Android Studio. In the end I had to use Eclipse (and don't forget to change your workspace to use Java 1.6 or greater)

Categories

Resources