We have killed a few pill bugs by keeping them in a Mason Jar with some dead leaves and fresh leaves. They lived for a few days, but were all bottoms-up at two days.
This time, they are still alive at Day 3.
I looked on the Magical Internet for how to keep them alive and read that they need wet sand, a rock that's not smooth, a twig, some leaves, and food-- either fresh leaves or some fruit.
Wish us luck at keeping the little bug alive for longer!