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.
Related
unfortunately this question was closed however it is spot on. Let me go through the steps as I am reproducing a legacy app issue that uses httpclient so switching is not an option YET (6 months out maybe).
create android studio app
try to use Httpclient and as he shows in the post above it is in red
I try to add this line in build.gradle to bring it in as a work around(even though core android also brings it in)
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
Then I get this error in android studio
`httpclient` defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for `httpclient` use `HttpUrlConnection` or `okhttp` instead), or repackaging the library using something like `jarjar`.
Ok, so I am using the wrong version so I run build scan and I see this so I bring this one in instead of the other version (android studio now sees HttpClient and can import it at this point)
I still get the same error though about conflicting android libs.
QUESTION: How do I fix the red in my legacy project and not have this error either?
My best bet seems to ignore the error. Will I have issues that I am not seeing though in the future?
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
I had a preview build installed which would render my layouts fine but when I tried to load some sample projects there would be some issue about not finding the sdk (even though it was pointing to the right location). It's been a few months since I updated AS and so I installed the latest stable build. I now can load sample projects without any sdk location problems, but now I always get errors when trying to preview a layout.
Specifically, it's saying there are missing styles, in this case '?attr/actionBarPopupTheme (image below). This is a sample project (ListPopupMenu) and so it should be there somewhere, right? How can I resolve this?
I'm using Build #AI-143.2489090
Change your app theme(click the button called “AppCompat”) to any other theme like AppTheme with no actionbar(just try four to five theme)
If that doesn't work,turn down the API version,the green robot button right side of theme button
If that is still not working,restart andoid studio
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
This should be pretty straightforward, but can't work this out for myself I'm afraid!
The following line of code triggers the error:
using Microsoft.Xna.Framework.Storage;
Error: The type or namespace name 'Storage' does not exist in the
namespace 'Microsoft.Xna.Framework' (are you missing an assembly
reference?)
But as far as I can tell, I have added the reference: (Solution explorer -> right click References -> Add reference -> .NET tab -> scroll down to Microsoft.Xna.Framework.Storage -> select it -> click OK).
Microsoft.Xna.Framework.Storage shows up when I expand "references" in the solution explorer.
What am I missing?
EDIT
Okay on second look this might be to do with how I'm adding the references. When I search in the object browser Microsoft.Xna.Framework.Storage doesn't show up (but when I search, for example, for audio, Microsoft.Xna.Framework.Audio does show up). Is there anyway to check that when I click "OK" on the add reference pop-up that it is actually working?
I see two likely possibilities.
You have a mismatch of XNA 4.0 and XNA 3.1 (or previous) references in your project. If the Storage reference you added is from 3.1, you'll get this message. You can try removing it, and then looking specifically for the 4.0 version during add.
The device you are building for may not support the Storage mechanism. In particular, Windows Phone apparently uses a different storage mechanism (System.IO.IsolatedStorage http://msdn.microsoft.com/en-us/library/ff604992.aspx).
Hope one of these helps.
This question was asked a long time ago, but if anyone else is still looking for an answer, here is how i fixed it.
If you installed the Microsoft.Xna.Framework references by using the installer from Microsoft, then it installs in C:\Windows\Microsoft.NET\assembly. I found all of the Xna libraries in GAC_32 and Microsoft.Xna.Framework.Storage in GAC_MSIL.
You can also use the GAC to find libraries that aren't in Visual Studio's reference list. For .NET Framework versions before 4.0, the libraries are in C:\Windows\assembly, and the libraries for versions after 4.0 are in C:\Windows\Microsoft.NET\assembly.
It's actually been removed from Monogame by Microsoft.
Running: Windows 10, with integrated graphics card (Intel G45/G43), Visual Studio 19, Monogame 3.7.1
Project Structure: Solution > Game.Shared, Game.Android, Game.OpenGL (followed this guide on creating a Cross-Platform project, method number 3).
I changed the Target Framework in my OpenGL project from .NET 4.5 to .NET 4.7.x (the newest version), and I was able to build and deploy the app to an Android device. Do this by clicking the project and selecting Properties.
I simply commented out the line. App will successfully deploy to an Android device this way. The game will then deploy, but I can't get any content to load.
Have yet to see if I can deploy to an iOS device, I will update this post when I figure out if I can.
No nuGet's installed.