I'm a absolute beginner in programming but I'd love to create my own Apps to make my (and someone else's) everyday life a little easier. I just downloaded the latest version of Android Studio and installed it with all tools.
I wanted to create a "Hello World" App as shown in many tutorials on YouTube. I followed them step by step but there is always this Rendering Problem directly after I finished creating a blank activity.
Rendering Problems
The following classes could not be instantiated:
-android.support.design.widget.FloatingActionButton (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
Exception Details
android.content.res.Resources$NotFoundException: Unable to find resource ID #0x1080029 at ....
I have no clue what the problem could be and how I solve it and all the answers on google and here on stackoverflow.com to a already existing Rendering Problem couldn't help me.
It's a bug in the Android Studio and Android Design Support Library (ver 23.2.0) that is solved in Dev/Canary channel.
For now, if you use the Stable update channel, you have to edit by hand the build.gradle file.
Under Project tool window -> Gradle Scripts open and edit the file build.gradle (Module: app).
Search for dependencies and make sure the com.android.support.design line looks like this:
compile 'com.android.support:design:23.1.1'
Save
Tools -> Android -> Sync Project with Gradle Files
Build -> Rebuild
Related
I have been dealing with a problem in android studio gradle for hours, and i could not solve it.
I am just trying to build my very first projects but there is a problem with gradle.
This is how my build.gradle file looks like:
plugins {
id 'com.android.application' version '7.4.0' apply false
id 'com.android.library' version '7.4.0' apply false
}
enter image description here
This is the context of problem:
A problem occurred configuring root project 'My Application'.
> Could not resolve all files for configuration ':classpath'.
> Could not find gradle-7.4.0.jar (com.android.tools.build:gradle:7.4.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.4.0/gradle-7.4.0.jar
> Could not find builder-7.4.0.jar (com.android.tools.build:builder:7.4.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/7.4.0/builder-7.4.0.jar
> Could not find bundletool-1.11.4.jar (com.android.tools.build:bundletool:1.11.4).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/1.11.4/bundletool-1.11.4.jar
> Could not find protos-30.4.0.jar (com.android.tools.analytics-library:protos:30.4.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/30.4.0/protos-30.4.0.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I also added the image.
I don't know how to fix this, and any help would be appreciated.
I've observed the same issue. I've found some ambiguities that might explain what's going on.
If you naviagate to https://maven.google.com/web/index.html#com.android.tools.build:gradle:7.4.0 you'll get a web page that will give you information about com.android.tools.build.gradle-7.4.0. If you hover over the link for the jar or pom file you'll get a different url from the ones that your search indicated: https://dl.google.com/android/maven2/com/android/tools/build/gradle/7.4.0/gradle-7.4.0.jar. Notice that the "/dl/" part is missing. That's at least what my browser was showing me at the bottom of the browser window. Seeing that, I went into my setting.gradle.kts file and edited my pluginManagment repositories section by added the following repository:
maven {
url = uri("https://dl.google.com/android/maven2/")
}
I was then able to build my project without getting an error about not finding the com.android.tools.build.gradle plugin. In my case, I saw a slightly different list of locations of what it was searching for. Mine was failing because it couldn't fine the gradle-7.4.0.pom file, and not the jar file. So, I'm not exactly seeing exactly what you're seeing, but there's a good chance it related since the pom file is normally read before the jar file when resolving plugin artifacts from a repository.
When I was getting the problem, I would copy the link of the repositories searched and paste it into a browser and sure enough I would get an http 404 error using those searched url location. And when I modified the link by removing the "/dl/" part of the link, the file would download. So, you might think that my explanation explains the issue. However, after I got the issue resolved, I reentered the URL that was failing in my browser (the url with the "/dl/" part), but this time it worked correctly without any errors. The only explanation that I can come up with on why the url sometimes works and sometimes fails is that the server or proxy server processing that url request is sometimes offline.
With all of that said, you may run into the next issue. In order to use android gradle 7.4 you must be using an version of android studio greater than Android Studio Dolphin | 2021.3.1 Patch 1. see https://developer.android.com/studio/releases#android_gradle_plugin_and_android_studio_compatibility Unfortunately, it is my understanding that all of the versions of Android Studio, that would be compatible with using android gradle plugin 7.4 are only available as preview Android Studio releases. So if you're developing and restricting yourself to only building code using officially released stable tools, you're stuck using android gradle plugin 7.3.1, until the next version of android studio gets official released.
After a hiatus of a couple of years I'm picking up Android development again.
I installed the newest Android Studio(4.1.1) with the latest Android SDK version (Android 11, API 30). After that I created a new project with gdx-setup.
If I add the old java source to my newly generated project I get this error:
error: package com.badlogic.gdx.backends.android does not exist
I'm not sure how to add this jar into the new project. In the Gradle configuration I see mentions of the backend, but it's not available.
I also downloaded the 'gdx-backend-android.jar' from the nightly build and put the jar in the Android library folder, all to no avail.
Does anyone actually know how to correctly add this dependency into my project?
I added the jar but still have an error, don't mind the other errors, I first need to fix the GDX import.
The project dependencies are managed by Gradle, so there is no need for you to directly touch any .jar files at all.
The most likely issue you're facing is that you are trying to use Android-specific classes from the core module, which is platform agnostic.
In a typical libGDX project, you do almost all your game code in the core module so it can easily be compiled for any platform. The code you showed above would be in the android module, but your LiveWallpaperStarter class would be part of core.
Some might say there's no reason to use core at all if you're making a Live Wallpaper, since it can't run on any other platforms besides Android. But there is some advantage in keeping the rendering in core so you can test in a desktop game window, because you can more rapidly compile and run on the desktop. This library has some tools that make it easy to wrap your rendering code in a class that lets you simulate a live wallpaper on desktop, for testing.
I had android studio and it was perfect without any problem. Everything was going right until I reinstall my windows to make PC a little faster. And then I install android studio the latest one. And though the last one was also up to date, there were no problem at all. But, in the new android studio any project I start or any project I open which has constraintLaoyout, the design view of xml get stuck with following errors.
Rendering Problem
Failed to find style 'coordinatorLayoutStyle' in current theme
Second error when I put any widget or anything on my activity
Missing Constraints in ConstraintLayout
This view is not constrained. It only has designtime positions, so it
will jump to (0,0) at runtime unless you add the constraints The
layout editor allows you to place widgets anywhere on the canvas, and
it records the current position with designtime attributes (such as
layout_editor_absoluteX). These attributes are not applied at runtime,
so if you push your layout on a device, the widgets may appear in a
different location than shown in the editor. To fix this, make sure a
widget has both horizontal and vertical constraints by dragging from
the edge connections.
First, update your project to use the latest build version. This helps fix a lot of problems when it comes to most Android views.
Second, go to your style and add this line of code to fix the first error
<item name="coordinatorLayoutStyle">#style/Widget.Design.CoordinatorLayout</item>
Third, the children of CoordinaterLayout must be constrained, if you are new to this layout, you can switch to RelativeLayout or you can use the design view to add constraints. View the official documentation here
A helpful video on constraints HERE
I found the implementations of dependencies in build.graddle(Module: app) were API 28 but there was only API 26 in following directory
C:\Users\[username]\AppData\Local\Android\Sdk\extras\android\m2repository\com\android\support\appcompat-v7
So I deleted all SDK platforms and build tools and installed them with API 26 in SDK manager(select Show Package Details).
Then I started new project. The projects made with API 26 had no rendering problems.
Have you tried adding design library in your build.gradle?
If not then just add it
implementation 'com.android.support:design:23.2.0'
Finally solved the problem. Writing this answer so that other can get help form similar kind of problem.
By default when we create a new project in android studio, it uses the latest API from SDK. In my case it was API 28. But, API 28 was incomplete or partially installed. I tried installing the API 28 completely but it did not work for some reason. Then I deleted that API 28 and installed API 27 latest. And by doing this when I create or open any new project that uses the API 27 and gets all the required things in there. And that is how I solved my problem.
Thanks everyone guys who tried to help me.
I'm very new to Android Studio and app development. I've have years of experience working with different platforms and languages, but I'm struggling to get a working example in Android Studio using the FrescoImageViewer library. How do I go about getting this from GitHub into Android Studio and have the example working?
I tried the simple Download -> Extract -> In Android Studio Go to File -> New Project -> Import Project and select the newly unzipped folder -> press OK
This results in lots of errors showing up in the code and also tells me it isn't using gradle and to migrate the project to gradle. I'm just looking to get a working example, then I can look it over and customize from there. I must be doing something wrong or missing something... sorry but I feel like this is a rookie question. I have looked a lot of places and tried many different things.
Here is the GitHub (https://github.com/stfalcon-studio/FrescoImageViewer).
To get it in your androidstudio project, my advice is the following
in builds.gradle file, app level:
implementation 'com.facebook.fresco:fresco:1.9.0'
implementation 'com.github.stfalcon:frescoimageviewer:0.5.0'
then in your application class, method onCreate,add :
Fresco.initialize(this);
By the way, don't forget to declare your application class in your manifest
and test this simplest sample in your MainActivity:
String[] listimages = {"http://www.personal.psu.edu/oeo5025/jpg.jpg"};
new ImageViewer.Builder(MainActivity.this, listimages)
.show();
I forgot, you will need this import in your activity
import com.stfalcon.frescoimageviewer.ImageViewer;
I am attempting to convert the Microsoft.Health C# class library that is installed as part of the HealthVault SDK, using instructions provided here. After following these instructions, I get the following error when attempting to load the project into Visual Studio 2013.
"The project is targeting frameworks hat are either not installed or
are included as part of future updates to Visual Studio. See
http://go.microsoft.com/fwlink/?LinkId=287985"
Visiting the link takes me to .NET SDKs and Downloads. Once there, I have no clue on what needs to be done.
I do realize that one will have to leverage the Portable Class Library Contrib project to fill in some missing bits, especially code related to System.Security. This, I will deal with later.
Any one run into a similar problem?
Maybe so late but for those who have the same problem.
I had the same error in a project which was working perfect before updating VS2013 and finally after 3 hours looking for the source of the error I found that the error is about TargetFrameworkProfile.
In my case I sloved it like so:
Right click in the unloaded project in your solution and click Edit.
Find the TargetFrameworkProfile tag and set it as below:
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
At a guess, this is because you need to specify the TargetFrameworkVersion and TargetFrameworkProfile properties in the project file. Compare the .csproj you are trying to create to a newly created PCL project file, and make sure that everything that's not specific to your project matches.
I ran into the same issue and got it resolved by installing the latest Visual Studio Update