Android Studio: appcompat installation fails - android

I've a strange problem. I just installed the most recent version of android studio and created a plain vanilla blank activity application. After that, when the IDE opens it tries to install com.android.support:appcompat-v7:14+. However, then I get the error message:
Failed to resolve: com.android.support:appcompat-v7:14+
Install repository and sync project
So, I click on Install repository and sync project however, then I get the following error message:
Loading SDK information...
Ignoring unknown package filter 'extra-android-m2repository'Warning: The package filter removed all packages. There is nothing to install.
Please consider trying to update again without a package filter.
And underneth it red it is stated:
Install Failed. Please check your network connection and try again. You may continue with creating you project, but it will not compile correctly without the missing components.
So, my internet connection is perfectly fine, no traffic gets block by an firewall or something.
What is wrong here? Are there alternatives for installing com.android.support:appcompat-v7:14+?

I think you have an incorrect version on your compile tag (23.0.1, instead of 14+):
Try:
compile 'com.android.support:appcompat-v7:23.0.1'
instead of:
com.android.support:appcompat-v7:14+
and you may need to update your compile and tools versions as well (which is required to use the new versions of AppCompat, etc):
compileSdkVersion 23
buildToolsVersion "23.0.1"

Go into your SDK Manager, and make sure you have updated the Support Libs (you will see I have those checked in the image)
You will need to make sure these are updated.
FYI, this is the new SDK Download in Android Studio - your UI may look slightly different, but you still need to update those components

I increased tmpfs size and the problem was gone.
I also had this problem with AndroidStudio 2.1.1 running on Fedora laptop. At the first glance this solutions sounds ridiculous since the error message says we should check the network connection. For some time I left off the problem because I did not find the solution. At some point later Gradle also started to complain that he did not have enough space in the disk. When I checked my file systems with df, only tmpfs looked full. Thus I extended it. Then the component installation problem was also solved.
You might not solve your problem by increasing tmpfs, but the point is that DON'T be mislead by the error message. We've got to check also somewhere else.

Related

Android studio isn't opening [duplicate]

Every time I run Android Studio, this loading screen pops up, but Android Studio stays here and doesn't load. It's like this following picture except that the loading bar is loaded all the way but stuck there. I am running Windows 10.
I have tried many things, including setting the system variables JDK_HOME to where my JDK is located and the same for JAVA_HOME. I have also set a path. I ran as admin many times and let AS through a firewall.
I have also restarted and reinstalled countless times.
The version of AS is 2.0, and I am running the latest versions of Java.
Any help?
Open file Android Studio setup directory/bin/idea.properties
Add disable.android.first.run=true to end
Restart Android Studio
PLEASE NOTE: This will break patch updating to the next version. We
now check full binary checksums on the whole installation to prevent
various install corruption bugs as well as to preserve application
signatures. Therefore, make a copy of this file first, and before
updating, put it back.
Please try the following method to fix that issue:
Find the folder of your AndroidStudio: based on the following directory
macOS: ~/Library/Application Support/Google/AndroidStudio[version]
Delete the AndroidStudio folder.
Restart
Ref:https://developer.android.com/studio/known-issues#studio-config-directories
In order to know how to debug the problem, I executed the bin\studio.bat script in the terminal and inspected the actual Idea exceptions in order to fix the problem.
For me, this was the issue:
ERROR - llij.ide.plugins.PluginManager - java.net.BindException: Address already in use: bind
java.util.concurrent.CompletionException: java.net.BindException: Address already in use: bind
This means the plugin manager is trying to listen on a port that is not available. Is something listening on that port? For me, it was the stupid "excluded ports" by Windows, so I simply stopped the service:
net stop winnat (as administrator), and confirmed that Android Studio started to work.
No need to re-install, delete precious configuration (and plugins, etc.). Just read the log provided by the bin\studio.bat script, and I was able to fix the issue.

Error code 1. Cordova Visual 2015 Studio

I was usually running my application, however was not getting access in the emulator due to the network proxy, I made some changes in the emulator network to gain access, however now when I run the application I'm having the following error:
I have tried clearing the cordova cache several times however not decided.
Also I tried to delete the specific way, however also not decided, what should I do with this error.
Sorry to hear about your trouble. There are a couple of things that could be causing this. One possibility is that you need the 64-bit JDK because you are running into issues. However, it looks like you're more likely missing a dependency.
Can you try running the dependency checker and verify that you're not missing anything? Go to tools -> options -> Tools for Apache Cordova -> Run Dependency Checker and install anything that it says you're missing.

Can't run a blank activity in Android Studio (rendering problems)

I'm very close to giving up with Android development. I don't currently have an Android phone so I'm trying to use emulators. In Eclipse, after fixing 500000 bugs/errors I finally managed to get an emulator to launch - but it kept getting stuck on the Android loading screen (even after like 45 mins) so somebody recommended me to use Android Studio.
I downloaded this on my PC, and when I tried to run a blank activity I got this error:
When I tried to actually play around with the activity, I got a rendering error:
I saw some stuff online that said to use a downgraded Android version for the error to go away - however, I only have 2 versions as you can see and none of them are working.
I tried downloading/installing Android Studio on my laptop too and got the exact same problems. What is going on? I have spent 2 days trying to run a blank activity now and am really on the verge of just giving up. Any ideas?
EDIT: Trying out Jorge Casariego's suggestion but cannot find Open Modules when I right click
Looks like it happens because you are updated Android build tools to "24.0.0 rc1" but not update gradle build plugin to 1.3.0-beta1 version.
Make sure that you have in yourProjectFolder/build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0-beta1' // or 1.2.3
}
And in yourProjectFolder/mainModuleName/build.gradle you have
android {
...
buildToolsVersion "24.0.0 rc1" // or 23.0.1
...
}
or as a variant use last stable versions of build tools
To downgrade your SDK, you need to download a different SDK version. To do this, you need to run the SDK Manager which is the 4th image from the right:
This will allow you to download different versions of Android, allowing you to get API 19/20/21, which should fix your issue.
I get this rendering problem all the time and I've been developing for almost 2 years now, with over 10 months on android studio. These rendering problems are only for the activity preview, which usually isn't very helpful at all anyway. If you don't have an Android device, my best suggestion would be to download the GenyMotion emulator. It is 1000x better than the built in emulator, and even has a plugin for android studio that allows you to run it from within the IDE. If you need to check how a layout works, I would recommend just running the app in the emulator, as you will get a much better idea of how things look anyway, rather than trying to approximate it with the layout previewer.
Edited 6/10/18:
The packaged emulator has been updated extensively and now performs much better. For that reason, I've removed the link to the 3rd party tool. I realize my intention at the time was to be helpful, but having a link to a 3rd party tool in a stackoverflow question seems inappropriate, especially given the reason for highlighting it is outdated.
To resolve this issue follow the following steps :
Go to your app folder under Navigation section.
Right Click -> Open Module Settings
Set Compile with SDK Version as API 22 or below (Lollipop)
Set Build version as 21.1.2
Clean + Build your Project
to use the new M preview, you'll need to also use Android Studio 1.3 Preview (from the canary channel).
I have this problem too. Because I named my App the wrong thing. It has a "-" character in the app name. Ex: Web-ViewDemo. It causes a wrong location, so android studio can't do anything totally right 100%.
In short, try to rename your app!

Gradle gets stuck at either 'build' or 'assembleDebug' when using the 64bit or 32bit version of Android Studio

The issue I've had over the past few months is that Android Studio would often get stuck on Gradle: build, as seen here. Android Studio itself would stay responsive but the build simply wouldn't progress. It also never generates any kind of error, so I can't really post any useful information. Once in a blue moon it might suddenly work, but nothing reliable.
Recently I found a post here on Stack Overflow where someone's Android Studio would get stuck on Gradle: build when he tried to create a new project, and he noticed that this issue didn't exist in the 32-bit version of Android. So I thought, why not try that. Turns out that building isn't an issue anymore, but assembleDebug is, when trying to build the application. As can be seen here.
Of course all these commands work flawlessly when run using command prompt and gradlew.
What I've tried so far:
Reinstalling Android Studio (including the removal of .AndroidStudioProject)
Upgrading Android Studio to the latest version
Removing any build files from projects
Creating completely new projects in Android Studio
Switching from 64-bit to 32-bit Android Studio
I'm running the latest version of Android Studio, using version 19.1.0 of the build tools, gradle v0.11+ and am on Windows 8.1.
Is there anything else I can try? This is starting to become seriously annoying. The last possible solution I can come up with is just doing a complete format and a fresh Windows installation.
I was experiencing the same problem, and the solution was very unexpected in my case: AVAST antivirus was somehow interfering with the Gradle:build process.
Deactivating this antivirus solved the problem!
Because there is no answer to this problem I will share, what I have done, to solve this issue. From what I have seen, the problem is that there is a dependancy(or many) from a maven repo that can not be loaded. So you have to take all dependacy one by one and check if exist on the maven repo.
For example I was having a dependancy for "org.jraf:android-switch-backport:1.3.1" from "http://JRAF.org/static/maven/2" that at that time could not be opened.
My build.gradle looked like this:
repositories {
mavenCentral()
maven {
url "http://JRAF.org/static/maven/2"
}
}
compile "org.jraf:android-switch-backport:1.3.1
For me, this problem occurred when I was USB tethering using an Android device. The first build took anywhere from 5-10 minutes, and every subsequent build took about 3-7 seconds. I found that by disabling USB tethering, the first build completed quickly (and so would all subsequent builds). After the first build completed, I could reenable USB tethering.
If you have a fresh Ubuntu 14.04 with Android Studio 1.5, you may be missing a library. Try this:
sudo apt-get install lib32z1
Another stack overflow answer
It happens 1 in 2 times for me. The hack that works for me is File->Exit and confirm exiting. Then a message shows up telling me that Gradle is running and then all of a sudden the screen to choose the device shows up. I Click NO and all goes well again.
Anyway, still a bummer, but I have not found an answer yet.
My problem was that the Android Sdk executables were missing the executable bit. You can check some of your binaries like /Sdk/build-tools//aapt to see if they have permission to execute. If not you can solve it by running this on the Sdk folder
chmod -R +x ./
If you are behind a proxy on ubunthu you might need to set your gradle system wide proxy:
sudo nano ~/.gradle/gradle.properties
And enter the following entries:
systemProp.http.proxyHost=<Your Host>
systemProp.http.proxyPort=<Your Host Port>

Android-Studio: Gradle projects won't build without internet connectivity even in "Offline Mode"

I've recently shifted to Android-Studio from Eclipse simply because of it's automatic code completion feature which I fell in love with. But Android Studio is giving me a hard time from the moment I installed. It is laggy, it freezes often, but the main problem is that it does NOT build my projects without connecting to the internet. I found this question where I found that we can build gradle projects without connecting it to the internet by enabling the "Offline Mode" but it doesn't work for me. Even if I set gradle to local distribution mode, Android Studio automatically changes it to default settings, which is really annoying. I've no idea what's wrong with Android Studio. I'm using version 0.4.6.
The event log shows this -
11:13:26 PM AssertionError: Already disposed: Already disposed
11:13:42 PM Failed to refresh Gradle project 'Study Buddy'
Unknown host 'repo1.maven.org'.
Please ensure the host name is correct. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
HTTP proxy settings Open Gradle documentation
However, when I connect to the internet gradle builds the projects without any error. But I want to use Android-Studio in Offline Mode since I've a really low bandwidth. Please help to fix this issue.
Offline mode works only after you've compiled one time online. I know, it doesn't make complete sense if you don't understand everything on how Gradle works. But, you have to compile one time online and then it works.
This of course is a moot point if you don't have access to an internet connection at the time you wish to compile. Or, if you're like me, it just doesn't work due to your company's proxy and firewall rules.
I did get it to work at my company but the latest upgrade broke it. And now, even the previous version doesn't work, but I think that was my company as well. They pushed out some "patches" and I think that's what broke it.
You should upgrade. Offline support has improved since 0.4.6; it's mentioned in the 0.5.0 release notes: http://tools.android.com/recent/androidstudio050released

Categories

Resources