We want to get rid of Error while building bundle file - java

I am trying to generate build key but it is showing
class FragmentNearbyBinding is public, should be declared in a file named FragmentNearbyBinding.java
public final class FragmentNearbyBinding implements ViewBinding {
^
as file under the build folder cannot be edited how can I get rid of this any help would be appreciated
I try invalidate cache and restart and ugrade android studio and build Gradle but still the problem remain the
same

Related

Intelij - > cannot access java.lang.Object class file for java.lang.Object not found

I'm trying to set up a new project in Intelij. It's a multimodule project, with a maven parent module, and the application server is WebSpere 9.0.5.0. The problem I encounter is when I ty to run it, I get the error java: cannot access java.lang.Object class file for java.lang.Object not found and then java: cannot find symbol symbol: class String for every single String in the code. If I click on a String to see the problem and see the fix of Intelij, it add the import org.apache.xpath.operations.String;
I'd the same problem, but with Android Studio, similar anyway, try this:
In toolbar: File -> Invalidate Caches / Restart... -> Invalidate and restart
I had the same problem, and in my case, invalidate caches didn't work. A colleague of mine pointed out: make sure in the definition of your SDK, the vm.jar file is included (File > Project Structure > Platform Settings > SDKs).
I added this file to the classpath and the red signs disappeared:
$PATH_TO_SDK/jre/bin/default/jclSC180/vm.jar
If this path does not exist for your SDK, find it!
find $PATH_TO_SDK -name vm.jar

isInvalidFragment passes wrong fragmentName after directory restructure

I am having an issue after placing my fragments into a sub directory with isValidFragment function.
All activities and fragments were previously under:
app/src/main/java/com/myproject/settings/
They are now located here:
app/src/main/java/com/myproject/settings/fragments/
After the move and placing import com.myproject.settings.fragments.*; in the SettingsActivity.java that is still located under settings/, isValidFragment is still receiving com.myproject.settings.GeneralSettingsFragment..
While my call to GeneralSettingsFragment.class.getName() is returning the correct com.myproject.settings.fragments.GeneralSettingsFragment.
See isValidFragment below:
#Override
protected boolean isValidFragment(String fragmentName) {
return PreferenceFragment.class.getName().equals(fragmentName)
|| GeneralSettingsFragment.class.getName().equals(fragmentName);
}
The error I receive:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myproject.settings/com.myproject.settings.SettingsActivity}: java.lang.IllegalArgumentException: Invalid fragment for this activity: com.myproject.settings.GeneralSettingsFragment
I have cleaned project and manually deleted build folder and rebuilt with no luck. Any guidance is appreciated.
If only to my future self..
Using Android Studio none of these worked :
rebuild
File->Invalidate Caches
Delete .idea/ folder and resync project with gradle
What needed to be done was using the gradle menu ( or command line ) use app->Tasks->build->build. This uncovered many issues with renaming in the .xml files where they weren't updated with the correct path ( com.myproject.settings.fragments.<fragmentName> ).

Cannot create an object of my class - why?

Android studio version : 3.2
I created an class(my first class ever on android studio)
by clicking new on java folder but in main activity I am not able to create an object of that class
In this image you can see an error free Animal class but in main activity I am not able to create an object out of it
Everything else looks fine to me
On rebuilding the project I am getting and error stating "cannot resolve symbol Animal"
I have already tried
rebuilding my project,
clean build,
restarting android studio
Make sure that class Animal is public.
Make sure that class Animal is in your app's package name. This might be the reason if you have copied and pasted the class from a page on the internet.

Importing from GitHub to Eclipse

I have actually managed to import a project from GitHub to Eclipse, but my problem is when I try to run the project it keeps saying fix errors on source files. Now I know that the code should work as the person who wrote this app has it in the Google App store. This keeps happening for me on all the projects I have downloaded.
Are the suggestions to what I am doing wrong?
Thanks for the replies, I am new to the whole programming world, so I am not sure whether or not the project has a build file or not.
As #Andres has said, my initial thought was that it was to do with the JDK/Android development kit being not the same as I have on Eclipse.
A link to the project is https://github.com/glebpopov/Hacker-News-Droid-App.
The first error I get says in the console window
Unable to resolve target 'android 7'
I also have this example for the beginning of the class Activity Helper:
public class ActivityHelper {
private static final String TAG = "ActivityHelper";
protected Activity mActivity;
protected SharedPreferences sharedPref = null;
And the error here for the second line of code say:
String cannot be resolved into a type
The error here for the third line of code says:
Activity cannot be resolved into a type
And there are plenty more across the whole code.
Some possible causes are:
The version published on GitHub has errors, and is not the same that is published on the google app store.
The project has dependencies that have not been resolved, because of your Maven (or similar product) configuration.
The jdk and/or android development kit required by the project are not the same as the one you have on your Eclipse

Saving java file in maven project fails

when I try to save a java file in my project the following error occurs.
Failed to (re)build the JAX-RS metamodel for projet TestApp
java.lang.NullPointerException
It only occurs when I create the default constructor so
public class Account {
public Account () {}
}
gets the error, while
public class Account {
}
does not get it.
I was using the jboss-javaee6-webapp-blank-archetype to create my project
I found the failure by myself, there was no src/main/java folder created(I had my files in the resources folder), I reinstalled Eclipse, now the folder gets created and when I have my java files there, I don't get an error anymore.

Categories

Resources