Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
brand engager
Mar 23, 2011

Hey how do I check what the android emulator is getting stuck on through the command line? I've got a jenkins server that is supposed to run one on builds, but it doesn't seem to be booting.

quote:

12:28:03 $ /var/lib/jenkins//platform-tools/adb start-server
12:28:03 * daemon not running; starting now at tcp:5819
12:28:06 * daemon started successfully
12:28:06 $ /var/lib/jenkins//platform-tools/adb start-server
12:28:06 [android] Starting Android emulator
12:28:06 $ /var/lib/jenkins//emulator/emulator -skin 240x320 -ports 5736,5737 -report-console tcp:5810,max=60 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_120_QVGA_android-25_google_apis-armeabi-v7a_10 -no-window -no-audio
12:28:06 emulator: WARNING: encryption is off
12:28:06 emulator: WARNING: Requested adb port (5737) is outside the recommended range [5555,5586]. ADB may not function properly for the emulator. See -help-port for details.
12:28:11 [android] Emulator reported that the console is available on port 5,736
12:28:11 [android] Waiting for emulator to finish booting...
12:28:11 $ /var/lib/jenkins//platform-tools/adb -s emulator-5736 wait-for-device shell getprop init.svc.bootanim
12:28:11 emulator: Cold boot: snapshot doesn't exist

quote:

12:42:49 $ /var/lib/jenkins//platform-tools/adb -s emulator-5736 wait-for-device shell getprop init.svc.bootanim
12:42:50 [android] Emulator reported that the startup process is ''
12:43:06 $ /var/lib/jenkins//platform-tools/adb -s emulator-5736 wait-for-device shell getprop init.svc.bootanim
12:43:09 [android] Emulator reported that the startup process is ''
12:43:24 [android] Timed-out after waiting 900 seconds for emulator
12:43:24 [android] Stopping Android emulator
12:43:24 $ /var/lib/jenkins//platform-tools/adb kill-server
12:43:24 emulator: WARNING: Not saving state: emulator hasn't finished booting.

Adbot
ADBOT LOVES YOU

brand engager
Mar 23, 2011

The plugin that does that randomly generates the ports on each job, and does not give an option to set them manually.

Edit: this plugin https://wiki.jenkins.io/display/JENKINS/Android+Emulator+Plugin

brand engager fucked around with this message at 08:01 on Mar 5, 2018

brand engager
Mar 23, 2011

I'm running a copy of it manually to see how long it takes to boot. Been 30 minutes so far and it hasn't finished. This instance doesn't have virtualization features so no hardware acceleration.


Edit: Still wasn't done booting after an hour and a half. :shrug:

brand engager fucked around with this message at 18:04 on Mar 5, 2018

brand engager
Mar 23, 2011

Volmarias posted:

It should take no longer than 5 minutes at the worst, sanity check that you can start ANY emulator on the build system first. Remove all the arguments and make a standard API 26 target or something.

I was running this avd

quote:

Name: hudson_en-US_120_QVGA_android-25_google_apis-armeabi-v7a_10
Device: Nexus 6 (Google)
Path: /var/lib/jenkins/.android/avd/hudson_en-US_120_QVGA_android-25_google_apis-armeabi-v7a_10.avd
Target: Google APIs (Google Inc.)
Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/armeabi-v7a
with
code:
sudo -u jenkins ./emulator -avd hudson_en-US_120_QVGA_android-25_google_apis-armeabi-v7a_10 -no-window -no-audio -verbose
Is there a way to define a more basic avd to check with?

brand engager
Mar 23, 2011

Trying some stupid poo poo



Edit: it boots now

brand engager fucked around with this message at 02:50 on Mar 8, 2018

brand engager
Mar 23, 2011

Is there any way to change the colors used for specific days in a CalendarView widget? Most of the color related methods are deprecated, and subclassing the widget hasn't exposed anything that can change colors.

brand engager
Mar 23, 2011

Volmarias posted:

You might want to use the material backport on GitHub and customize it in this case. Not sure how far back you need to support or how much you care about device L&F

Our minimum API level is at 15 right now. I might just abandon the color thing for now since this is for a class group project.

brand engager
Mar 23, 2011

Been working on a bug at work where a ContentProvider is dying or not being started up or something. The app is split into multiple processes so it's probably some awful concurrency bullshit. I think we also have parts of the code that just get the database itself and then interact with it which might be a nono. Anyone got some dos+don'ts for working with these that arent in the official ContentProvider guide?

brand engager
Mar 23, 2011

I don't know why, it was before I worked there

brand engager
Mar 23, 2011

It runs in three processes. We've got one that has all the activities, one that has network stuff and native c/c++ junk, and a "utility" process that I cant remember what it's responsible for.

brand engager
Mar 23, 2011

lmao

brand engager
Mar 23, 2011

Why bother manually assigning primaries, doesn't every db have an autoincrement for that

brand engager
Mar 23, 2011

if you can't depend on the row number or whatever you could embed something unique to that data into the pendingIntent for the notification using Extras

brand engager
Mar 23, 2011

Does android studio's debugger work with native code? Maybe ours is just too busted for it to attach, but I haven't been able to get it working.

brand engager
Mar 23, 2011

PokeJoe posted:

yes it does. are you sure the code you're break pointing is actually running?

It wasn't even attaching to the process last time I tried

brand engager
Mar 23, 2011

Anyone have experience with the Compose library in jetpack? It looks like their version of swiftUI view building but I don't know how complete it is.

brand engager
Mar 23, 2011

FAT32 SHAMER posted:

it isn't very complete yet, but it's extremely promising and the moment it's stable and fully released we are planning on tearing all xmls that we possibly can out to replace it

Does it work with the databinding stuff since you need to have a <layout> tag at the root for databinding to generate the class?

brand engager
Mar 23, 2011

FAT32 SHAMER posted:

i believe databinding exists solely to prevent bullshit npe's from occurring with xmls by generating classes that call findViewById for you to statically reference, so whatever the name of the view you declare it as in compose is what you reference in your fragment logic and it ~just works~

*i haven't played with more recent versions of compose so this may have changed in the last 3 months

I think i'll be stuck with xml since we're already redoing our UI. I've been working only on our ios app since late last year, so getting moved back to android has been a mess. UI stuff is already slower than any other work, and I'm also trying to remember how to do anything in android.

brand engager
Mar 23, 2011

We're also supposed to change to a model-viewmodel-view architecture so I'll need to figure that out too

brand engager
Mar 23, 2011

Do you need the 4.1 plugin for something?

brand engager
Mar 23, 2011

I didn't see any mention of it in the release notes. Anyways the trick to gradle is to use the oldest version that both has the features you need and isn't busted, and just dont update it until you absolutely have to.

brand engager
Mar 23, 2011

What causes android 10 to automatically grant the camera permission? I have some test app that only declares uses-permission for android.permission.camera, and when I install it the camera permission is already granted. Everything I've found in the documentation says the camera permission can only be granted by asking at runtime.

Edit: it's loving gradle doing it somehow. Doesn't happen if I install manually with adb, but using the installDebug task automatically grants the camera permission.

brand engager fucked around with this message at 22:26 on Apr 28, 2021

brand engager
Mar 23, 2011

kitten smoothie posted:

What version of the Gradle plugin are you using, looks like this may have been fixed in 4.2. The idea was to auto grant permissions for instrumented tests but it just granted whatever was in the manifest all the time

https://issuetracker.google.com/issues/172112073

It was a new project so just whatever version it defaults to now

brand engager
Mar 23, 2011

We have a multi-process app, and recently we found out that a bunch of classes that implement Parcelable were being stored to the filesystem and in a database in the marshalled form. Don't do this, it really sucks to fix

brand engager
Mar 23, 2011

Does DataStore<Preferences> not work across processes? Getting the feeling that google really wants people to stop using multiple processes for a single app

brand engager
Mar 23, 2011

Volmarias posted:

I know it's not an answer, but I'm genuinely curious what your reason is for multiple processes in your application.

We have one of those apps that runs other apps in a container. Other apps get spawned as separate processes. But in this case I was trying to use datastore from the normal app process and a second process we have a bunch of our backend code running in.

E: anyways I ended up putting the datastore access in a content provider and writing the boilierplate stuff to do contentresolver calls interacting with it

brand engager
Mar 23, 2011

Cool if you try to dismiss a DialogFragment from an activity's onStop the dialog throws a runtime exception. loving clown OS

brand engager
Mar 23, 2011

Can they quit hopping architectures for like 5 minutes

brand engager
Mar 23, 2011

Does compose not have something to wrap an existing activity or fragment into a compose hierarchy? AndroidView only works for views, which isn't that useful since the activity/fragment and its viewmodel do the useful work on views

brand engager
Mar 23, 2011

FAT32 SHAMER posted:

Your option is to “inflate” a composable in a fragment (I.e. use the fragment as the composable host which is then hosted by your activity) and nuke any viewbinding and xml associated with it, or go whole hog and use your activity to host composables and map their flow using the new jetpack composable navigation and nuke all of your fragments and refactor large swathes of your view models

That's the opposite of what I meant but it's not possible anyways. They just don't have an equivalent of UIViewControllerRepresentable

brand engager
Mar 23, 2011

Aren't you supposed to do all this setup in the onBind or whatever it's called? The recyclerView is probably messing with those viewHolders every time it recycles one so I wouldn't count on handlers set in a constructor

brand engager
Mar 23, 2011

Had to dig up our old app that still uses recyclerviews, we only did view inflating in onCreateViewHolder and we setup any handlers in onBindViewHolder

brand engager
Mar 23, 2011

LongSack posted:

Except that the Java version works.

It probably shouldn't have

brand engager
Mar 23, 2011

this spot where you're making a state object further down in the composable is gonna create a new state every time the library checks if it needs to recompose, that's gonna cause some weird issues
Kotlin code:
item = mutableStateOf(toDoItem),
what is this function?
Kotlin code:
items(state.items) { toDoItem ->

brand engager
Mar 23, 2011

Also that StateFlow class isn't a Compose state, it just happens to have use state in the name. I don't think it'll cause recomposing like the actual androidx.compose.runtime.State type will

brand engager
Mar 23, 2011

LongSack posted:

The state object is created in the viewmodel which is injected into the composable, and should be scoped to the lifetime of the composable

You're also making one in the spot I quoted though which is a problem for reasons already mentioned

LongSack posted:

That's where the LazyColumn gets its items from


The book I worked through prior to starting this project(Kickstart Modern Android Development with Jetpack and Kotlin, here) develops an app using viewmodels and state and it simply uses a MutableState<T> object (with a public State<T> getter) and it works just by using copy() on it as the state changes, and it seems to work just fine.

Oh ok thought you had created your own forEach()

brand engager
Mar 23, 2011

Usually I do code reviews in android studio, and piecing the whole thing together from different posts is kinda a pain. Think you're gonna have to figure out the issue yourself lol

brand engager
Mar 23, 2011

This isn't related to the bug, but you can remove that backing property for the state by changing to
Kotlin code:
var state by mutableStateOf(
    ItemState(
        null,
        emptyList(),
        true,
        null,
    )
)
private set
from https://developer.android.com/jetpack/compose/state#viewmodels-source-of-truth

brand engager
Mar 23, 2011

Why is StateFlow still in the viewmodel? You don't seem to be using the actual flow parts of it. You're also still recreating state objects on every attempted recompose https://github.com/vjkrammes/ToDoPl...Activity.kt#L31, that's gonna cause problems like mentioned before.

Adbot
ADBOT LOVES YOU

brand engager
Mar 23, 2011

Feel like i'm losing my mind, this coroutine runs but never recomposes after the state change
Kotlin code:
@Composable
fun Something() {
    val name by produceState(initialValue = "unknown") {
        delay(5_000)
        value = "some name"
    }
    Text(name)
}
I've put logging in there before to verify that it's running. It should recompose since the Text is observing that state but it never happens

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply