Eclipse JUNO + ADT 23.0.2 Resources$NotFoundException - java

After I recently installed the latest Eclipse ADT bundle I get some errors in an old project I was working on:
No known package when getting value for resource number 0x7f080028
android.content.res.Resources$NotFoundException: String resource ID #0x7f080028
at android.content.res.Resources.getText(Resources.java:222)
at android.content.res.Resources.getString(Resources.java:275)
at android.content.Context.getString(Context.java:183)
...
In my R-file there is the correct connection between the string I'm looking for and the resource ID.
I tried several things to solve my issue:
clean all projects
rename all resource-names to lower case names
restart computer
I used "adt-bundle-windows-x86_64-20130522" (it compiled without runtime errors) before and downloaded "adt-bundle-windows-x86_64-20140702" because of an error occurred during an update.
Any suggestions?

EDIT: Looks like a new build-tools version (21.0.2) has been released that addresses this issue! The best fix is now to update to this version, rather than revert to an older version or swap out aapt.exe files.
My short answer: use an older version of the Android SDK Build-tools, for now. There's likely a bug with including certain types of files in the assets directory in versions 21 and 21.0.1 of the build-tools--or at least that's why I was receiving the error messages after updating.
My long answer:
I just spent the better half of this morning with the same issue. Frustratingly enough, only two out of three of the projects I work on presented it, but it at least gave me a starting point. I found that the failing projects included a zip file in their assets folders while the working project did not. Removing this zip file allowed all apps to run, but that's obviously not a good enough solution.
I'm going to go out on a limb here and assume that there's a bug in the newest Android SDK Build-tools release (revisions 21 and 21.0.1) that fails to properly build the APK if there's a zip file in the assets folder with certain properties (I didn't research enough to figure out the exact triggers). Just zipping an empty text file wasn't enough to trigger this, but I managed with a small 13KB zip file. I don't know whether any other types of files cause this.
For an immediate fix I just went back to using an older version of the build tools. As seen here, that involves modifying the project.properties file to include sdk.buildtools=20 (for Eclipse users) or the build.gradle file to include buildToolsVersion "20" to the android section (for Android Studio users). Version 20 worked to get me back up to speed, while version 21 breaks my apps. Your current list of installed Android SDK Build-tools versions can be seen in the Android SDK Manager, under Tools.

I was facing the same issue for the past 3 hours, after tiring search of Google and other websites
came to a conclusion that this error (Cannot resolve symbol :R )
occurs specially with gradel tools version 21.0, 21.0.1, 21.0.2 and 21.1
BUT it is resolved in build-tools 21.1.1.
For Android IDE users , following steps can work.
go to your project's Gradel Scripts folder.
select the folder build.gradel(app) { not the other build.gradel("your mainActivity classname").
open the build.gradel(app) file,
CHANGE the buildToolsVersion to "21.1.1" from your old buildToolsVersion..
4.Sync your project one more time.
5.That's it.
It worked for me.

Related

AndroidManifest.xml and Bluetooth Chat, in Android Studio

A gentleman was kind enough to pass me a link of a repository with bluetooth functionality. I imported it from GitHub. I tried then copying it, but noticed eventually that Android Studio built and organized a different style of directory than that from the github repository. So I deleted the entire directory, and just pasted that of the github depository in.
However, the repository version suffers from the fact that the classes say "Java file outside of source root". Moreover, when I tried to import it, it generates the error "The project is using an incompatible version (AGP 7.3.0) of the Android Gradle plugin. Latest supported version is AGP 7.2.2". I read online I could just update Android Studio instead of downgrade Gradle. When I do the most recent update (I think), Android Studio tells me that the project doesn't use the Gradle build system.
Also, AndroidManifest.xml says that it can't resolve certain activities, such as "MainActivity", which does exist. I think AndroidManifest.xml is in the root folder as it should be.
Any idea what is wrong with my program? At this point, this is just copy-and-pasted from the github Bluetooth Chat program. Is that outdated, etc?
I have spent hours trying to troubleshoot this. Perhaps there is someone with some experience in it.

java.io.IOException: Can't read. In unity when I try to build my game

I have a problem when I try to build my game it shows me this error: java.io.IOException: Can't read
[C:\Users\niksr\OneDrive\Documents\Unity\2021.3.8f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\optional\android.car.jar] (Can't process class [android/car/Car$CarServiceLifecycleListener.class] (Unsupported version number [55.0] (maximum 54.0, Java 10))) See the Console for Details.
Before this, I was able to build my game. I was really close to publish it on play store, but it said "Your app currently targets API level 30 and must target at least API level 31 to ensure it is built on the latest APIs optimized for security and performance. Change your app's target API level to at least 31.". I changed it to 33, but then I tried to build my game and this error showed up. After that, I changed it back to the original API level, but this error still showed up.
I don't know why this error persists, but please help me solve this problem.
I had the same issue. Reverting back to API 32 solved the issue and had no feedback from google.
In case you still have the issue try installing API 32 with the commandline(first remove the folder in the platforms folder).
I installed API 32 with commandline with the sdk manager.
go to where the sdk is installed in your case:
C:\Users\niksr\OneDrive\Documents\Unity\2021.3.8f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK
Then run:
./cmdline-tools/2.1/bin/sdkmanager "platforms;android-32"
I was able to get rid of it by enabling 'Use R8' but then Google Play won't accept my ReTrace mapping file.
Another option is to build it with Andriod Studio.
Install Android Studio with api 33.
set api 33 in the player settings at the project.
Then at build settings select export project.
BuildSettings
Open de exported folder in android studio.
Find a error about the code line
enableR8=false
Delete that line as it is outdated.
And follow the appropriate build steps for you.

bazel build error - tensor flow

I am struggling to put my model in the Android studio.
In order to use my model in the Android studio, I also know that I need to put the libandroid_tensorflow_inference_java.jar and libtensorflow_inference.so files into the assets folder in Android Studio.
So I used git to download the tensorflow library and use it to build .so and .jar files.
During the creation of the .so file I faced a problem that I could not solve.
I installed the SDK in the Android studio according to the procedure, and since I currently only support NDK version 17 in the studio, I installed version 12 externally and unzipped it.
~/tensorflow/WORKSPACE
In order to build a bazel, I modified the content of WORKSPACE in the root folder of tensorflow as shown above. this
But I had to face these terrible errors.
this this
To solve this problem, I changed the NDK location and installed another version of NDK. I tried to take other actions but the error did not go away. I have been working from yesterday to solve this problem. I need your help.
It looks like you're missing the -std=c++11 flag.
Try passing this additional Bazel flag: --cxxopt=-std=c++11.

Can't get gradle compatibility in Android Studio on Windows 10

I am new to Android Studio, and thanks to my dog knocking water on my Mac, I am using my PC with Windows 10 for the foreseeable future. Since I'm trying to learn Android Studio while also trying to pinpoint all the bs Windows is doing in the background, I have been beating my head against the wall for several days. To start, the PC I'm using has a 128GB SSD and a 1TB HDD, and since Windows is busy filling up my C: drive (the SSD), I am trying to keep everything else on the HDD. I originally installed Android Studio and went with the defaults, which put it on the C: drive, but when I realized what happened I uninstalled it and re-installed it on the D: drive. I also installed all the SDK tools and API versions on the D: drive.
The problem I am running into is every time I try to import a project from a tutorial, it says the project isn't synced with Gradle (these tutorials are all using older APIs and Gradle versions) and won't even give me the option to build. Originally, I set the GRADLE_HOME environment variable for the Gradle version installed on my D: drive to D:\Program Files\Gradle\gradle-4.8-bin\gradle-4.8\bin and then I could at least run the gradle command without getting "command not recognized...". At that point, the new projects I had created were running fine, but any project that used an older version would not sync. I guessed that I might need to install the older Gradle versions in order to be compatible with older projects, so I installed all of them and put them in the same D:\Program Files\Gradle directory, then set that to my environment variable. That broke everything since the variable was no longer pointing to a bin folder I assume. Now when I try to import a project using Gradle external model, it doesn't matter if I select the specific Gradle path to the /bin folder on the D: drive, or if I set it to C:\Users\brand.gradle, it says 'Gradle location is incorrect'. The only way I can make the gradle command work is if I go to the /bin folder for any one of the versions I have installed, and run it from inside the directory.
I know that when Android Studio installed it put the gradle configuration in C:Users\brand.gradle, part of the reason why I thought changing the GRADLE_HOME variable might fix it. Currently, the gradle command will not work if I am in the C:\Users\brand.gradle directory. I have researched a lot but can't seem to find clear answers, especially in regards to the newest versions of everything, so here are my primary questions:
Where does AS store and look for the gradle configuration on Windows by default (not for an individual project, but for Android Studio itself), and how can I get it to store and look for things on the correct drive?
Do I need every gradle version installed to be able to run projects that use older versions, and if so, is there a way that Android Studio can automatically find the appropriate version if they are in the right location?
In short, I want AS to do everything on my HDD, where all of the SDKs and gradle versions are installed, but I think it is looking in the wrong places by default, and perhaps even changing things back to default values after I change them. I want this to stop, but can't figure out what it's doing.
If you are running android Studio version 4.1.2 then go to Files -> Setting -> to
Build, Execution, Deployment, click on Gradle and it will show you the Gradle user home, it is here that you can change the directory. But make sure you copy over the Gradle files first to the external drive.

Eclipse Incorrectly Claiming I have old Rev of Android SDK

Just to preface this I have searched high and low on the internet trying to find an answer to this problem and have yet to find one, there have been people with similar problems as me but not quite the same.
I have been trying to set up Eclipse with the Android SDK. I installed Eclipse (Classic) first and edited the .ini file to find the correct javaw.exe file. I tested eclipse and it was working fine. Then I downloaded the android sdk bundle extracted it and used the SDK manager to download the necessary SDK tools (Rev. 21) and the Android 2.33 API. After finishing that, I went back into Eclipse, clicked "Install New Software" and in the "Work With" field typed
"https://dl-ssl.google.com/android/eclipse/". From there I installed the Developer Tools and NDK plugins and then when finished restarted Eclipse.
Now when I start Eclipse I get the following error
"This version of ADT requires Android SDK Tools revision 21.0.0 rc9 or above.
Current version is 11.0.0
Please update your SDK Tools to latest version"
I know for a fact I have rev 21, it said it when I downloaded it and when I try to go in and update anything whether it be through Eclipse or through the manager it says there are no updates available. I know I have the latest of both the SDK and ADT and I have also tried using the version of eclipse that came with the sdk but that gives me the same issue.
The only other things which seem to set off red flags to me are
1. When the program loads it shows the following message in the console
"[2012-12-01 18:31:48 - Dex Loader] SecurityException: Unable to find field for dex.jar"
2. When I try and open the SDK manager through eclipse it never opens and the console displays the following message
"[2012-12-01 18:37:07 - SDK Manager] [SDK Manager] Error: Expected verb after global parameters but found 'sdk' instead."
I don't know if either of those two have anything to do with what is causing this issue but I hope someone knows what is going on. If someone could help me figure this out I would greatly appreciate it, thank you in advance.
(For reference sake, I have been following the instalation instructions in this tutorial
http://youtu.be/31cxmLN09ss)
When in the SDK Package Manager, try choosing Packages menu -> Reload. Then you should see Android SDK Tools rev21 available and ready to be updated.
i had the same problem. it occurred because once when I was trying to install the adt plugin few months earlier, the location had been saved. I oversaw the old folder location, mistook it for the current updated one and bam! that was all the reason. try to check back the location for tools folder specified.
As follow up to my previous suggestion, better solution is to modify your sdk location in Windows->Preferences->Android to where you install your ADT bundle. For example, if you install your ADT Bundle under C:\Tools\adt-bundle-windows-x86-20130219, enter C:\Tools\adt-bundle-windows-x86-20130219\sdk.
Doing this also fixes other issue with "Android SDK Manager" not launching from within Eclipse discussed on another thread.
I resolved the issue with Eclipse reporting that I have an older sdk even though I have the latest installed by copying the correct sdk version under "C:\Program Files\Android\android-sdk". First save existing "C:\Program Files\Android\android-sdk\sdk" to say "C:\Program Files\Android\android-sdk\sdk_old", in case you need to revert.
This (above) is sound advice: however I went in eclipse and redefined the android sdk location which apparently was on a different android folder for whatever reason which had outdated files in it and I believe now the situation is fixed I tried it and it worked for me too. Thanks.

Categories