Can't Repro
Status Update
Comments
lb...@gmail.com <lb...@gmail.com> #2
BTW, even after fixing all except the classes, it build fine.
Problem is that the classes don't exist, and I can run the app, and only then I get the crash...
Problem is that the classes don't exist, and I can run the app, and only then I get the crash...
ni...@google.com <ni...@google.com>
jl...@google.com <jl...@google.com> #3
Hi Michal, Tor this could be handled with XML validation.
be...@google.com <be...@google.com> #4
Looking at the log, it seems the IDE was in a very weird state, not finding any files. Were you able to reproduce it since? Are you using Subversion (it shows up in the log)?
lb...@gmail.com <lb...@gmail.com> #5
@4 I did use it, but why does it matter?
The project is a new project. I just copied text of a layout file from one project to another, and a new one too (which doesn't use subversion).
This was tested at the office.
I've tried now again, at home. Got a bit different results. Using this:
Android Studio 3.4 Canary 7
Build #AI-183.4284.148.34.5159543, built on December 3, 2018
JRE: 1.8.0_152-release-1248-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
The issues I've found now:
1. After creating the new project, the "R" isn't found (right after creating the new project and letting it to build), even though I didn't paste anything yet.
2. The resource are with red-underline, but not the class that doesn't exist.
See attached video and log.
The project is a new project. I just copied text of a layout file from one project to another, and a new one too (which doesn't use subversion).
This was tested at the office.
I've tried now again, at home. Got a bit different results. Using this:
Android Studio 3.4 Canary 7
Build #AI-183.4284.148.34.5159543, built on December 3, 2018
JRE: 1.8.0_152-release-1248-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
The issues I've found now:
1. After creating the new project, the "R" isn't found (right after creating the new project and letting it to build), even though I didn't paste anything yet.
2. The resource are with red-underline, but not the class that doesn't exist.
See attached video and log.
be...@google.com <be...@google.com> #6
We've had issues with R classes in Kotlin in the past, I filed b/120797515 separately for that. As for (2), AFAIK we've never highlighted this as error, mostly because it's up to the layout inflater to decide how to handle tag names (in other words, aapt doesn't check the class names at compile time). I'll make a note to rethink that.
It seems the original problem for this bug is no longer reproducible? I'll close it for now, please update it if you see it again.
It seems the original problem for this bug is no longer reproducible? I'll close it for now, please update it if you see it again.
lb...@gmail.com <lb...@gmail.com> #7
@6 Please do think about marking classes that don't exist. Those will cause a crash at runtime.
It should also check that inflation is even possible, using the correct CTOR.
And I think you already do check the classes, just not mark them. The check is done while trying to preview. If it fails, it shows an error there.
So same should appear on the XML editor. At least, put a warning instead of error.
It should also check that inflation is even possible, using the correct CTOR.
And I think you already do check the classes, just not mark them. The check is done while trying to preview. If it fails, it shows an error there.
So same should appear on the XML editor. At least, put a warning instead of error.
Description
Android Studio 3.2 Beta 1
Build #AI-181.4892.42.32.4847800, built on June 19, 2018
JRE: 1.8.0_152-release-1136-b04 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Libraries used:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-alpha3'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
implementation 'com.google.android.material:material:1.0.0-alpha3'
Steps:
Create a new project.
Edit the layout XML file.
Replace all with a layout file of a different project. The layout could include various resources that don't exist on the new project, and usage of classes that don't exist there.
The bug:
It doesn't mark anything with red underline, as if everything is ok.
Not only that, but it fails to auto-complete anything.
Here's an example of a layout file that should have a lot of errors on such a case:
<LinearLayout
xmlns:android="
android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize"
android:theme="@style/AppTheme.WhiteAppBarOverlay"/>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent" android:layout_height="wrap_content" android:fillViewport="true"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/button" style="@style/SecondaryButton" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/some_dimen"
android:src="@drawable/some_drawable"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
In the above example, we have :
- resources that don't exist, of various types
- classes that don't exist (example: NestedScrollView on this path)
- no auto-completion, even on framwork classes
- no red underline for anything
- even after a build everything in the XML is not marked.
Attached sample video showing the issue.