Always asking
Tuesday 12 November 2013
New Android event in Seville
If you happen to be in Seville on the 19th November 2013, don't miss this opportunity to take part in the first BOP ever!
Tuesday 5 November 2013
Do you android.content.res.Resources$NotFoundException: unknown resource ? (aka Testing with Robolectric (II))
I assumed that one only needed to specify the location of the manifest if, like here, you were extending the Application class. After reading and failing miserably to get the most stupid test up and running, turns out that when you have BuildTypes and/or Flavours you have to explicit about your manifest too.
So if you are getting one of these pesky exceptions: Double check that you specify the location of your AndroidManifest file in the
So if you are getting one of these pesky exceptions: Double check that you specify the location of your AndroidManifest file in the
@Config
anotation.
Labels:
Robolectric
,
unit test
Debugging Gradle
Always wanted to find out how does Gradle the thing it does? Is it driving you crazy not knowing why that script is not working?
Attach a remote debugger
TL;DR
Attach a remote debugger
TL;DR
- Add a new system variable:
- Start your Gradle task
- Run your favourite IDE's debugger
Labels:
Android Studio
,
Gradle
Monday 28 October 2013
Testing with Robolectric (I)
If you have your own Application class for your Android app, you might have found your tests failing because of a class cast exception:
You can annotate also annotate the whole suite.
java.lang.ClassCastException: android.app.Application cannot be cast to BLALBLA classAnd if you are using Robolectric 2.+ the way to solve this is to annotate your test with
@Configlike so:
You can annotate also annotate the whole suite.
Labels:
Android Studio
,
Application class
,
Robolectric
,
unit test
Wednesday 11 September 2013
Get Google Play services in your app (Intellij Android Studio)
You can find an easy way to get Google Play services in your project here
But for an even easier way, this is your safest bet
UPDATE:
If you change update your Studio, make sure to run a clean and build. Wasted morning N+1
But for an even easier way, this is your safest bet
UPDATE:
If you change update your Studio, make sure to run a clean and build. Wasted morning N+1
Labels:
Android Studio
,
Google Play Services
,
Intellij
Friday 5 July 2013
Running tests Test running startedTest running failed: Unable to find instrumentation info for: ComponentInfo{ [package.name]/android.test.InstrumentationTestRunner} Empty test suite.
I have been trying to run tests using Intellij's Android Studio. So I started here and used the IDE to help me create everything I needed. Failed horribly. Then I followed this and kept receiving this HELPFUL message:
like a billion times!
These are the things I have learnt:
like a billion times!
These are the things I have learnt:
- Android/Studio use JUnit 3 so the constructor for your test suite MUST NOT have any parameters (aka don't let Studio create a constructor for you because it will add a parameter and JUnit will not be able to find your test suite):
- Your test needs to be in:
More info - The package of your test needs to be different from the package of the class you want to test, i.e: if the package for your activity is
then the test should be in - Don't bother trying to run it from the IDE (don't believe this)
- Start your emulator
- Go to <yourProjectDir> (or where your gradlew is)
- Run
./gradlew connectedInstrumentTest
- The results can be found at:
Labels:
AAPT
,
Android Studio
,
Intellij
,
Junit
,
unit test
Monday 3 June 2013
Android Studio (Intellij) can't find aapt...but it's there!!! (UPDATED)
UPDATE: I have also encounter this with the following error message (it can be fixed the same way or following this):
db: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
If you are having problems with Android Studio (Intellij) when trying to run it for the first time with a message like:
android-apt-compiler: Cannot run program "PATH/TO/android-sdk-linux/platform-tools/aapt": java.io.IOException: error=2, No such file or directory
db: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
If you are having problems with Android Studio (Intellij) when trying to run it for the first time with a message like:
android-apt-compiler: Cannot run program "PATH/TO/android-sdk-linux/platform-tools/aapt": java.io.IOException: error=2, No such file or directory
I found this (basically create symbolics links to the actual place where the files are. Didn't do anything for me) and THIS which actually fix it for me.
Turns out, as you can clearly read from the error message, it was a architecture problem. Aapt expects 32 bit binaries and my desktop is 64 bits.
Turns out, as you can clearly read from the error message, it was a architecture problem. Aapt expects 32 bit binaries and my desktop is 64 bits.
With a nice:
apt-get install ia32-libs
it should work
Labels:
AAPT
,
Android Studio
,
Intellij
Subscribe to:
Posts
(
Atom
)