Android Java compiler error (compiling old files?!) - java

I refactored some packages in my IDE and everything seems to be ok. But when I compile my app I get an error that file x.java can't be read in x.java.
Both files are located in the old packages which do not exist anymore.
The package definition is fine in all classes. Also the Manifest is fine.
I'm using IntelliJ IDEA from JetBrains.
java: error reading K:\APP\src\com\renemaas\android\APP\About.java; K:\APP\src\com\renemaas\android\APP\About.java (The system can't find this path)
I hope someone can help me with this problem.
Note: Yeah I have search for nearly 1 hour to solve this problem on my own. I'm new to Android development.

Related

Having trouble setting up Eclipse for android development

I need to set up a workspace in eclipse to edit an APK so that I can mod it. I have the decompiled and deobfed java sources but I have never done this before, and I can't get eclipse working with android. I have installed the sdk and the software for eclipse, but I have some errors after creating a new basic project. Here are some of the many errors, Probably stemming from 1 problem that I just cant figure out.
XML:
Error in an XML file: aborting build.
\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
Among many, many more XML errors that look similair.
Java:
ActionBarActivity cannot be resolved to a type
R cannot be resolved to a variable
The import android.support cannot be resolved
The method getMenuInflater() is undefined for the type MainActivity
There are definitely some jars that should be in the build path that are not there, but I don't know why they aren't there and what is missing. I probably set it up wrong but I tried uninstalling and reinstalling and that did not help.
Sorry for the shitty formatting I have no idea how to format and this is my first question on here sorry!

Recompiling and running a decompiled MCP minecraft client throws a noSuchMethod error

So in the past days i've decompiled minecraft 1.12.2 using mcp to make an "own" client. I ran it from eclipse and all was working just fine. But once i exported it, added the needed JSON file and started it from the minecraft launcher, it resulted the following error:
Exception in thread "Client thread" java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.info(Ljava/lang/String;Ljava/lang/Object;)V
at net.minecraft.client.Minecraft.<init>(Minecraft.java:420)
at net.minecraft.client.main.Main.main(Main.java:115)
In my opinion that'a a bit strange, because when I ran it from eclipse that error did NOT occur.
I was thinking about adding the logger in the specific JSON file for the version but I do not know how to do it. I took the JSON file from a video where I expected my problem to be solved, made some changes, but it didn't. I also put the folder containing the logger-jar (org.apache....) in the client jar, but still no success.
Also i just decompiled 1.12.2 and recompiled it right away to see if i had messed up my code some how.
I hope someone can help.
This means at runtime you have a class that is different than what you had at compile time. You should try unzipping the jar and searching for the class file. It sounds like you need to potentially remove it and replace it with your own version.
Thanks to all who viewed an wanted to help!
Now I found an other way to use it. I wanted to export it to test
it on my server. But instead I used my account credentials to log in directly from eclipse.
:)

Cannot access greenfoot.World - class file has wrong version

I try to use Intellij IDEA for Greenfoot development on Mac.
Here is a tutorial to use NetBeans with Greenfoot:
https://www.greenfoot.org/doc/running_on_netbeans
So I created my scenario in Greenfoot. Then saved it and opened it in IDEA.
I took greenfoot.jar and bluejcore.jar from application package and added these libraries to a project structure.
At this point I receive the following error:
Error:(9, 30) java: cannot access greenfoot.World bad class file:
/Users/.../Greenfoot/greenfoot.jar!/greenfoot/World.class
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
Some conflict with a version. However I took both jars from the Greenfoot application installed on my machine. Appreciate some help.
The error says, that greenfoot.World was compiled with Java 11 and you try to use it with a compiler supporting up to Java 8.
Try changing the JDK

Cannot resolve corresponding jni function

i read a lot of posts but cannot resolve this yet.
There is my error lines and structure of project:
Some libraries and configs I take from another project... And don't know where I went wrong.
I will give you source code of files if needed
Thank you for any help.
I've also been getting this error since upgrading from Android Studio 2 to 3. The code compiles, but the IDE isn't recognizing the native functions. (This may be due to a preprocessor macro I've created that simplifies JNI function names.)
I've suppressed this error in Java by adding #SuppressWarnings("JniMissingFunction") before my class declaration.
Ok, so this missing 'JNI function' isn't a big deal. I know it's highlighted red, but the function is being linked, just not in a way that the IDE can determine.
First, here's the relevant source code: https://github.com/koreader/crengine/blob/master/android/jni/cr3engine.cpp#L770
CrEngine is linking the functions at run time. The reason why your IDE isn't picking them up is because the CrEngine functions start with Java_org_ instead of Java_com_. If you were relying on the engine to automatically link, this would be an issue, but as stated before, they are being explicitly linked at runtime with jniRegisterNativeMethods.
Do a clean and update your build tools to 25.0.3 (or better) in your gradle.build file. Update your SDKs and NDK. Then rebuild. Some of the errors I saw could be caused by older build tools.

IInAppBillingService.java does not generate Java file in Android Studio

I am following this tutorial:
https://developer.android.com/google/play/billing/billing_integrate.html#billing-permission
No InAppBillingActivity file is generating. I'm not sure why. I checked to make sure everything is placed correctly but no luck. Here is what my folder structure looks like:
Click this for picture
Now I know there are similar questions like this but none of them were able to solve my problem. I have already imported googles billing library as well. No file generates when I run / build the app.
The problem is that the docs are not very accurate in specifying where it is that you will find the java file that should be in the gen folder. I had faced the same problem and had broken my head over it, until I found that the .java file was infact generated and it was in the path :
\app\build\generated\source\aidl\debug\com\android\vending\billing\IInAppBillingService.java
Its not a headache issue and your code runs smoothly itself without any interventions required. Hope this helps!
In android studio double click on your package name:
click in New and then on AIDL
Hope it helps
Its usually generated but not put where the tutorial tells you. If you do a Ctrl+N and type in the class name in intelliJ you may be able to find it

Categories