Cannot resolve symbol '#style/Theme.AppCompat' - android-studio

since android studio upgrade to Android Studio Dolphin | 2021.3.1, the layout xml shows "Cannot resolve symbol '#style/Theme.AppCompat' "
Here is a screenshot of the code
the build.gradle is:
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.0'
...
}
When I comment out this line of code, everything becomes normal:
dependencies {
// implementation 'androidx.appcompat:appcompat:1.4.0'
...
}
When I press the key combination ctrl+left mouse button on "android:theme="#style/Theme.AppCompat" to quickly guide to the following position, as shown in the figure:
Theme.AppCompat is here in the values.xml
I don't know what this is, who can tell me?

I have solved the problem:
Upgrade the agp to 7.3.0, the gradle to 7.4, synchronize, validate and restart

Related

Autocomplete not working correctly in Android Studio with Flutter - First suggestions are irrelevant

I installed Flutter and Android Studio.
I ran flutter doctor - Flutter doctor
I have the Dart plugin installed - v191.8593.
When I press Ctrl + Space at a very obvious place the AutoComplete do not suggest the right suggestions.
Example:
View animation here
As you see the first suggestion are not of type ScrollPhysics and are out of context,
and after I scroll down, there are ScrollPhysics suggestions, but they are after some scrolling.
This problem can be fixed by one of the following
Invalidate caches and Restart fixed my problem.
Goto
File-> Ivalidate caches / Restart -> Invalidate and Restart
Restart Dart Analysis Server. Follow the pic below
Note all above solutions works but are not permanent as it appears there is bug in latest dart Analysis server you can follow subscribe to this reported issue for more updates
Restart Dart Analysis Server :-
Navigate to Dart Analysis tab at bottom.
Click Restart Icon (red colored icon on top left corner of Dart Analysis Window)
Wait for dart analysis to finish.
If it does not work, try this :-
Delete .packages and pubspec.lock files present in your project folder
run flutter pub get
I fix this by enable the Scope Analysis, at Dart Analysis-> Set Icon-> CheckBox.
In my case, I run in android studio terminal:
flutter upgrade
if you type stful it gives you the autocompletion of stateful widget for you.
or you have to go to
> Setting -> Editor -> Live Templates ->(choose)Flutter->(tick the option)stful
This is the image Depicting the Steps
I had the same problem and solved it by changing the first letter of my project directory's name from capital letter to lowercase letter.
Example : "My_project" => "my_project"
The solution was found there : https://github.com/flutter/flutter-intellij/issues/5978
In my case, restart android-studio worked.

How to prevent auto formatting after moving files to another package in Android Studio?

Whenever I try to move file to another package, Android Studio reformats file's code structure to a different state.
For example such part of code:
doSomething(makeSomeParameters(value1, value))
becomes:
doSomething(
makeSomeParamaters(
value1,
value2
)
)
Notice that this line was not exceeding 100 columns constraint.
I use code style from official Kotlin style guide.
To configure the IntelliJ formatter according to this style guide,
please install Kotlin plugin version 1.2.20 or newer, go to Settings |
Editor | Code Style | Kotlin, click on "Set from…" link in the upper
right corner, and select "Predefined style / Kotlin style guide" from
the menu.
When you attempt to move a file to another package and Android Studio shows this dialog:
Uncheck the Update package directive check box; Android Studio will not reformat the code in the file.

Android Studio 3.1.3 Preview screen blank

im a total newbie to Android Studio. I know the blank Preview screen is a known issue. On another thread a solution was to change something called 'AppCompat'.
The solution given was as follows:
"Change AppCompat library version in Gradle :
From
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
To
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
It Works !"
My question is, where do I find the AppCompat library version so that I can change this 1 line of code?
Many thanks
Fe

Android Studio does not perform automatic error detection

I'm using Android Studio 1.1.0 in Mac OS X 10.10. I noticed that when I wrote code like:
public void;
or even:
+ (bad) thisObjectiveCCodeShouleNeverCompileInJava:(ButSomehow *)itsNotComplaining
Android Studio didn't complain. Once I built it, Gradle showed the error, but the editor pane still did not. I attempted to use Navigate > Next Highlighted Error, I got the following balloon over my text cursor:
I let it sit for up to half an hour and still, no errors or warnings were ever highlighted. Similarly, placing the text cursor in/on a variable name does not highlight its usages in the file (but Edit > Find > Highlight Usages in File works fine).
I tried updating to 1.2.x, but I get this:
At one point, when attempting to Make Project, I got the following:
What's going on, and is there any way to fix this without reinstalling Android Studio from scratch?
Most of this is because I had Power Save Mode enabled. Unchecking this re-enabled error highlighting and other such features.

AS 0.4.2 not resolving ActionBarSherlock in GUI, though builds ok

I've added ActionBarSherlock to an existing android app that includes three of my own libraries. It was super easy to add the maven reference to the build.gradle files of the main project and the libraries that needed it, so that the main project now has:
dependencies {
compile project(':ads')
compile project(':core')
compile project(':iap')
compile files('libs/libGoogleAnalyticsServices.jar')
compile 'com.android.support:support-v4:18.0.+'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
}
I can go to the command line and do a ./gradlew assembleRelease and everything builds and runs as expected. However, when I'm inside Android Studio (0.4.2), it won't recognise the import statement, e.g.
import com.actionbarsherlock.app.SherlockActivity;
will get a nice red underline below "app". Accordingly the IDE shows errors for the unrecognised references. I've tried:
clicking the "Sync Project with Gradle Files" button
using the GUI to add the library reference (Open Module Settings, "Dependences" tab, "+")
restarting Android Studio
reading a lot of Stack Overflow articles!
Any suggestions on next steps? The ability to import via the compile / maven dependency was awesome, but being able to edit cleanly in the GUI would be nice :-).
To clear the errors, right click on the project and select Properties. Select Java Compiler and change the “Compiler compliance level” to 1.6.
After upgrading to Android Studio 0.4.6, this problem disappeared. Go figure!

Resources