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.
Related
I should preface this by saying that I don't know much about programming or android app development at all. I am trying to get a program running to control my pool cover automatically. This program is fairly old, which I imagine is the reason for the issues. I have been following this guide to sign and bundle the APK. As soon as I clone the project from github, I am greeted with this:
ERROR: Could not determine the class-path for class com.android.tools.idea.gradle.project.sync.ng.SyncAction.
In addition to this, the "Generate Signed Bundle / APK button" is not available.
From what I can gather, this program uses Gradle 1.10.
Here is the complete output log that I got from android studio
I might have found a solution for your problem but being a project as old as this, you can have problems with library usages.
The reason you're seeing this error is, using info from this answer, because this project was written in Eclipse IDE. The answer says:
when Eclipse export a project to gradle, it use an old gradle plugin version that Android Studio doesn't support.
Following his instructions I changed my Gradle version to 2.3, but Android Studio showed some more errors asking me to upgrade my version to 3.3, as showed here in Project Structure (You can easily access this using Ctrl + Alt + Shift + S).
Notice that Android Studio also asked me to set my gradle plugin version to 2.3 on another error, that I did. You should be aware that I had to change my distributionUrl in gradle-wrapper.properties file, as you can see here
Lastly Android Studio demanded me to change buildToolsVersion because it couldn't make my app with original config. Also what gave me the most trouble was the runProgruard function that Studio said didn't exist. I found the solution in this answer. My app build.gradle ended like this.
PS: At EVERY step of changing this configurations I had to go to menu build->rebuild project and then use the gradle button "try again". Sometimes it might seems it is not working, but with patience you will get there.
I'm getting the following error when I try to run my App on my SmartPhone:
Didn't find class "munyul.game.android02.android.AndroidLauncher" on path: DexPathList
Due to HD issues, I was forced into rebuilding my machine and setting up my developed environment again. After a lot of messing around, I have the following installed and working:
Java 1.8
Eclipse Neon
libGDX
Android SDK Manager
The Android App in question was almost finished, but now that goal seems like a long way off :(
I used libGDX to create a new project, and then I copied the old code into the new project - this is where things got messy.
I had to fix several errors caused by changes in libGDX, which was easy. I then also had to fix several errors caused by changes to Google Services, this was not easy! I eventually read about the new m2repository folder, then I searched for and found the class files needed (play-services-ads, -base, -basement, -games and -plus, inside .aar files), placed all the classes.jar files into their own directory within the android/libs project folder, finally adding references to them from within Eclipse - now everything compiles and looks good (should these .jar files be checked for export? - see edit)
Finally, I had to make one more change; the old project/code was created with a package: munyul.game.android02.android, but the new only had munyul.game.android02, I added the missing package to the new and also updated the AndroidManifest.xml file (maybe this is what went wrong!?).
I've checked the code and manifest and everything looks correct, but when I run the App it instantly crashes with the above mentioned error.
Also, I've checked the Order and Exports for the android project, the boxes that should be checked are.
Anyone know what else I could try?
EDIT:
As a test, I checked the Google Services JAR's for Export, and now I'm getting a different error:
Could not find class 'android.support.v4.util.ArrayMap', referenced from method
com.google.android.gms.common.api.GoogleApiClient$Builder.<init>
I'm starting to think that my error lies with how I resolved my Google Services issues - is there a better way of linking the missing classes? Somehow adding them via Gradle?
EDIT #2:
I migrated the entire project to Android Studio - now the APK installs and runs correctly on all my devices.
Honestly, I would have prefered to stick with Eclipse, but it seems like that is no longer an option - HTH
Check your AndroidManifest.xml for the correct application class (or none if you are not overriding.) The AndroidLauncher is part of the "instant run" feature available in Android Studio and is automatically injected by gradle into the manifest file.
Eclipse is no longer a supported development toolchain - you'll want to do your migration to Android Studio (or IntelliJ) sooner rather than later.
So I created an Android studio project, then trough it I created a Git repository and published it.
Now I'm on a different computer trying to sync it all. So from the home of android studio I select "Check out project from Version Control" then Git, paste the github repo link and it imports the code, but no all.
When I open the imported project the Gradle Script is missing (tough it's not shown even in the GitHub repo), the manifest folder and to show the res folder i have to change the type under 1:project to "project".
If I open an activity xml file it won't give the option to switch between Design and Text. And it doens't recognise some component like "AppCompactActivity" in the java files.
Anyone knows what is happening and how to solve this?
Thanks
Probably you didn't commit all files. Also you should check that the IDE is the same on both computer, same gradle plugin, same Android Studio version and so on.
Check that your gradle exist on your github repo in remote
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.
I'm sure I've just missed something obvious, but I'm at a loss of where to look to solve this.
I'm trying to get started with android wear, and am following the tutorial on this page.
However I can't find any information about which libraries I need to include or where to get them from.
I'm using eclipse and have used the Android SDK manager to download the Android Wear System Image (although I have a G-Watch to test it on) and all the 4.4W stuff, and I've set the project to build against 4.4W but I still get the following error
The import android.support.v4.app.NotificationManagerCompat cannot be resolved
The import android.support.v4.app.NotificationCompat.WearableExtender cannot be resolved
I have the android-support-v4.jar included and android.support.v4.app.NotificationCompat is found OK, but I can't see anywhere in the android wear docs that it says I can get this library and it's driving me nuts.
If someone could point me in the right direction that would be great.
Thanks
There is no android.support.v4.app.NotificationManagerCompat in the support library.
There is in the current one. Examining my android-support-v4.jar shows this class. Make sure that you have the latest version of this JAR downloaded to your machine (from the SDK Manager) and in your project (e.g., copied to libs/ from $SDK/extras/android/support/v4/, where $SDK is wherever your Android SDK is installed).