Status Update
Comments
di...@google.com <di...@google.com>
je...@google.com <je...@google.com>
ga...@google.com <ga...@google.com> #2
This should be moved to the Android Public Tracker > Text
component, but I don't have permissions so I'm redirecting to the appropriate owner.
ni...@nrbtech.io <ni...@nrbtech.io> #3
So after updating to 1.4.1 and all deps too, the crash was a little different see below.
The repro for that one is easy
- create a new app from AS 7.1 RC 1
- update deps to (Appcompat 1.4.1/Material 1.5.0/Constraintlayout 2.1.3)
- Add 2 textViews
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text1" />```
- In onCreate:
val t1 = findViewById<TextView>(R.id.text1)
val t2 = findViewById<TextView>(R.id.text2)
val charBuffer1 = CharArrayBuffer("AAA".toCharArray())
charBuffer1.sizeCopied = 3
val charBuffer2 = CharArrayBuffer("AAA".toCharArray())
charBuffer2.sizeCopied = 3
t1.setText(charBuffer1.data, 0, charBuffer1.sizeCopied)
t2.setText(charBuffer2.data, 0, charBuffer2.sizeCopied)
- Run see the texts updated then crash with the following. (Tested on P6 Pro Android 12)
Process: org.debug.myapplication, PID: 32493
java.lang.NullPointerException: src == null
at java.lang.System.arraycopy(Native Method)
at android.widget.TextView$CharWrapper.getChars(TextView.java:13588)
at android.text.TextUtils.getChars(TextUtils.java:155)
at android.text.BoringLayout.hasAnyInterestingChars(BoringLayout.java:314)
at android.text.BoringLayout.isBoring(BoringLayout.java:340)
at android.widget.TextView.onMeasure(TextView.java:9413)
at androidx.appcompat.widget.AppCompatTextView.onMeasure(AppCompatTextView.java:607)
at android.view.View.measure(View.java:25774)
at androidx.constraintlayout.widget.ConstraintLayout$Measurer.measure(ConstraintLayout.java:811)
at androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.measure(BasicMeasure.java:466)
at androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.measureChildren(BasicMeasure.java:134)
at androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.solverMeasure(BasicMeasure.java:278)
at androidx.constraintlayout.core.widgets.ConstraintWidgetContainer.measure(ConstraintWidgetContainer.java:120)
at androidx.constraintlayout.widget.ConstraintLayout.resolveSystem(ConstraintLayout.java:1594)
at androidx.constraintlayout.widget.ConstraintLayout.onMeasure(ConstraintLayout.java:1708)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:496)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:761)
at android.view.View.measure(View.java:25774)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3628)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2424)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2694)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2143)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8665)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
at android.view.Choreographer.doCallbacks(Choreographer.java:845)
at android.view.Choreographer.doFrame(Choreographer.java:780)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
bi...@google.com <bi...@google.com> #4
since it is possibly related to emojicompat reassigned
ni...@nrbtech.io <ni...@nrbtech.io> #5
Thanks for the report.
What version of Android are you testing this on?
bi...@google.com <bi...@google.com> #6
Android 12 P6 pro P3a and emulator A 11.
Can test on others the last repro is easy to test.
ni...@nrbtech.io <ni...@nrbtech.io> #7
Thanks! That's helpful to know it's reproing on both 11 and 12 - no need to test on others. We'll have to explore a bit.
ww...@gmail.com <ww...@gmail.com> #8
Any feedback on this? Appcompat 1.6 is around the corner with Android T. Migrating away from CharArrayBuffer is a ton of work to try to keep the huge performance gain it provide for my use case.
ww...@gmail.com <ww...@gmail.com> #9
Going out in next release.
bi...@google.com <bi...@google.com> #10
There's no code workaround that enables emoji and allows that setText overload to be used in the current version.
Other options:
emojiCompatEnabled=false
in your theme will skip emoji processing (please enable it again once fix goes out)- Don't use setText(char[]) (sounds like this is not really an option for you)
- Hold back appcompat upgrade until the fix goes out.
The fix will go out in emoji2:emoji2-views-helpers 1.2-alpha02 so you may be able to bump that dependency early to test it.
ww...@gmail.com <ww...@gmail.com> #11
Branch: androidx-main
commit 297989f164a9913a4c4c90e3fdd571203dca0830
Author: Sean McQuillan <seanmcq@google.com>
Date: Thu Mar 03 13:21:07 2022
Safely process no emoji from TextView$CharWrapper
This avoids calling TextView.setText when the text has not been updated
by emoji2. This has the impact of avoiding an extra text layout on emoji
font loading.
Fixes:
Test: ./gradlew :e2:e2-v-h:cAT
Relnote: "Fix crash when emoji2 loads font and TextView.setText(char[])
was used."
Change-Id: Id511e36ce9a9077309855082de88f00c26024c9d
M emoji2/emoji2-views-helper/src/main/java/androidx/emoji2/viewsintegration/EmojiInputFilter.java
M emoji2/emoji2-views-helper/src/androidTest/java/androidx/emoji2/viewsintegration/EmojiInputFilterTest.java
bi...@google.com <bi...@google.com>
ni...@nrbtech.io <ni...@nrbtech.io> #12
Thanks for the fix I can wait as nothing mandatory in appcompat 1.4 for my use case.
Is there some compatibility matrix between appcompat and emoji ? (Mostly will emoji 1.2 work with app compat 1.4 in case there's blocking stuff to support T and appcompat 1.6?)
[Deleted User] <[Deleted User]> #13
Great to hear!
I don't have a compat spreadsheet, but 1.2 is going to be 1.1 with bugfixes like this so no concerns here.
ro...@miquido.com <ro...@miquido.com> #14
Future readers:
Currently not planning on doing a appcompat 1.4.2 bugfix release containing this patch, but we can roll one if it's becomes necessary for some reason.
Please re-open ticket if this is blocking you.
ww...@gmail.com <ww...@gmail.com> #15
Sorry to post again here but the root issue now also impact Pixel phones when changing the text after having used a char array. (So will crash with Emoji too when it actually do change the text as the fix only fix when the content does not change)
Since there was no reaction there for a long time
bi...@google.com <bi...@google.com> #16
Thanks for the ping :looking:
ww...@gmail.com <ww...@gmail.com> #17
Disabling analitics is fine for local machine but is really a chore when you have huge team and multiple build servers. Can it be done locally in the project so it can be pushed to git for example? Maybe in gradle.properties
or something similar?
bi...@google.com <bi...@google.com> #18
I am afraid it cannot be done in project like in gradle.properties
bi...@google.com <bi...@google.com> #19
Actually, can you try adding com.android.tools.analytics.AnalyticsSettings.setOptedIn(false)
to the build.gradle
file of each root project?
In your sample project, add it to MyLibrary/build.gradle
and MyApplication/build.gradle
ww...@gmail.com <ww...@gmail.com> #20
I couldn't add exact code you've provided bacause of the error Unresolved reference: setOptedIn
.
Intrestingly enough I could set opt in flag via reflections:
Class.forName("com.android.tools.analytics.AnalyticsSettings")
.getMethod("setOptedIn", Boolean::class.java)
.invoke(null , false)
It somewhat works but first sync always fails with the original error Could not create an instance of type com.android.build.gradle.internal.profile.AnalyticsService
.
Don't know how it will behaive with CI. Will check somewhere later, don't have access to CI at the moment.
ww...@gmail.com <ww...@gmail.com> #21
I don't know if these are really related but even though you can sync project from the second try - native code breakpoints don't work even with Dual
debug type. Moreover LLDB doesn't even attach on its own when debug type is Detect Automatically
.
It was not a problem with 7.1.X and Bumblebee.
bi...@google.com <bi...@google.com> #22
That is weird cause I am able to make it work by adding it to your sample project.
bi...@google.com <bi...@google.com> #23
Fixed with I905dd70a2e7ccf05b3a7da1c83e2af4260b71ece and the fix will be available since 8.0-alpha01.
ka...@gmail.com <ka...@gmail.com> #24
While I am building I receive:
"A build operation failed.
Failed to create service 'com.android.build.gradle.internal.profile.AnalyticsService_704aac9b-2502-42f4-80cd-cccdba9bb437'.
Failed to create service 'com.android.build.gradle.internal.profile.AnalyticsService_704aac9b-2502-42f4-80cd-cccdba9bb437'.
Could not create an instance of type com.android.build.gradle.internal.profile.AnalyticsService.
Cannot query the value of this property because it has no value available."
Details:
Android Studio version: Android Studio Electric Eel | 2022.1.1
OS: Windows 10
Java versions: Oracle OpenJDK 11.0.10, Azul Zulu version 13.0.10
And some more details below:
I would like to mention that my Android Studio project contains two projects on the same root as it is mentioned in the previous comments (multi-root project).
Here are some more tests I did:
Windows 10, Android Studio Electric Eel | 2022.1.1, Gradle 7.5, AGP 7.4.0 => The problem as it is described above
Windows 10, Android Studio Electric Eel | 2022.1.1, Gradle 7.5, AGP 7.3.1 => Build and run successfully
Windows 10, Android Studio Electric Eel | 2022.1.1, Gradle 7.4, AGP 7.3.1 => Build and run successfully
Mac OS Monterey 12.6.2, Android Studio Electric Eel | 2022.1.1, Gradle 7.5, AGP 7.4.0 => The problem as it is described above
Mac OS Monterey 12.6.2, Android Studio Electric Eel | 2022.1.1, Gradle 7.5, AGP 7.3.1 => Build and run successfully
Mac OS Monterey 12.6.2, Android Studio Dolphin | 2021.3.1, Gradle 7.5, AGP 7.4.0 => The problem as it is described above
Mac OS Monterey 12.6.2, Android Studio Dolphin | 2021.3.1, Gradle 7.5, AGP 7.3.1 => Could not run due to the reason that AGP 7.3.1 requires as minimum the Gradle 7.4
As I can understand, the problem is on the AGP 7.4.0 which tries to create the AnalyticsSettings instance.
As a current solution to my problem, I am using Gradle 7.5 with AGP 7.3.1 in the latest Android Studio versions(Dolphin and Electric) for my project.
Regards,
ga...@linecorp.com <ga...@linecorp.com> #25
Fixed with I905dd70a2e7ccf05b3a7da1c83e2af4260b71ece and the fix will be available since 8.0-alpha01.
Is it possible to backport this change on stable version(AGP 7.4)?
pa...@gmail.com <pa...@gmail.com> #26
@ww... in #20
> I couldn't add exact code you've provided because of the error Unresolved reference: setOptedIn.
This happens when the class is not on the right classpath.
It's housed in com.android.tools.analytics-library:shared:30.4.0.
Which is a transitive dependency of com.android.tools:sdk-common:30.4.0.
In one of the AGP 7.x versions a lot of dependencies (including sdk-common) have been moved from compile to runtime scope in the POM, so they moved from compileClasspath to runtimeClasspath configuration in Gradle.
So, in Kotlin we need the class be present and compileClasspath, Groovy doesn't care as it's interpreted and does exactly the reflective code you posted.
I couldn't make it work with this hack, tried many-many ways, but only synced by editing analytics.settings.
dm...@mapbox.com <dm...@mapbox.com> #27
The only workaround that worked was to disable `Send usage statistics to google` in settings, changing flag manually in `~./android/analytics.settings` had no effect and AS kept overwriting the file.
pa...@gmail.com <pa...@gmail.com> #28
Edit the file and make it read-only. It will warn on every AGP build, and on AS startup you'll get a weird opt-in dialog, but AS won't be able to change it back.
fu...@gmail.com <fu...@gmail.com> #29
Fixed with I905dd70a2e7ccf05b3a7da1c83e2af4260b71ece and the fix will be available since 8.0-alpha01.
Is it possible to backport this change on stable version(AGP 7.4) or gradle(7.5+)?
bi...@google.com <bi...@google.com> #30
Unfortunately, it is not an option
da...@gmail.com <da...@gmail.com> #31
Please advise if possible on a solution. Thank you in advance.
[Deleted User] <[Deleted User]> #32
// id "com.android.application"
// id "kotlin-android"
// id "dev.flutter.flutter-gradle-plugin"
//}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
//apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
namespace "com.example.notification_fiebase"
compileSdkVersion 33
ndkVersion flutter.ndkVersion
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
multiDexEndabled true
// TODO: Specify your own unique Application ID (
applicationId "com.example.notification_fiebase"
// You can update the following values to match your application needs.
// For more information, see:
minSdkVersion 19
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.google.firebase:firebase-bom:32.7.1"
}
'flutter' for extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
solve that issue
Description
DESCRIBE THE ISSUE IN DETAIL:
While Gradle 7.2 works fine, and Gradle 7.4 works fine in AS 2021.1.1, Gradle 7.4 fails in AS 2021.3.1 Canary 7 with the following exception:
STEPS TO REPRODUCE:
ATTACH SCREENSHOTS/RECORDINGS OF THE ISSUE
ATTACH LOG FILES (Select Help > Show Log in Files, or Show Log in Finder on a Mac)
Build: AI-213.6777.52.2113.8305692, 202203160046,
AI-213.6777.52.2113.8305692, JRE 11.0.13+0-b1751.21-8125866x64 JetBrains s.r.o., OS Mac OS X(aarch64) v12.3, screens 3456.0x2234.0, 5120.0x2880.0; Retina
AS: Dolphin | 2021.3.1 Canary 7; Kotlin plugin: 213-1.6.20-M1-release-for-android-studio-AS6777.52; Android Gradle Plugin: 7.1.2; Gradle: 7.4; Gradle JDK: version 11.0.13; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: 3.18.1-g262b901, from PATH: 3.22.0