Profile cover photo
Profile photo
Werner Dittmann
About
Werner's posts

It seems AS 2.3 has some regression when compared to AS 2.2, at least for my projects :-)

For my projects, which use native libs and need to support older Android versions (starting with API 16) AS 2.3 is less stable than 2.2. Probably I need to go back to 2.2

When I do a new build where I only change a native lib (manually running ndk-build just before the build, no changes in Java code) AS 2.3 does not push/install the new APK but tries to launch the app on the device immediately. This fails with error messages telling that it cannot find the Activity class to launch and shows 'Error type 3'. The device under test runs Android 4.4.4

To overcome this issue I tried to clean the build cache first, then run another build. This time AS 2.3 pushes/installs the APK, then launches the app and it works. Doing yet another build right after another ndk-build (no changes in Java code) fails again. Thus I always need to clean the build cache to force AS 2.3 to push/install a new APK. Disabling the build cache with the setting in gradle.properties does not help either.

For my projects I disabled instant run because they use native libraries and support older Android versions. I tried to enable instant run (just for fun) and of course it made things even worse.

I tried all the various settings in the configuration -> Installation setting, however no success. I also tried to invalidate AS caches and restart, also no success.

Of course I update the gradle Android plugin to 2.3.0, gradle version 3.3.

Because I use native libs and they have a complex setup the gradle.properties file has this setting:
android.useDeprecatedNdk=true

I tried to use the new native build stuff in Android's gradle plugin, again no success.

Just for info: after a build I often (always?) see a short "gradle sync in progress..." or the info that gradle file were changed and a sync is necessary, however I haven't changed gradle scripts at all, just cleaned the build cache.

Any ideas what to set and to force AS 2.3 to push/install a new APK every time to the device?


+Jamal Eason
It seems AS 2.3 has some regression when compared to AS 2.2, at least for my projects :-)

For my projects, which use native libs and need to support older Android versions (starting with API 16) AS 2.3 is less stable than 2.2. Probably I need to go back to 2.2

When I do a new build where I only change a native lib (manually running ndk-build just before the build, no changes in Java code) AS 2.3 does not push/install the new APK but tries to launch the app on the device immediately. This fails with error messages telling that it cannot find the Activity class to launch and shows 'Error type 3'. The device under test runs Android 4.4.4

To overcome this issue I tried to clean the build cache first, then run another build. This time AS 2.3 pushes/installs the APK, then launches the app and it works. Doing yet another build right after another ndk-build (no changes in Java code) fails again. Thus I always need to clean the build cache to force AS 2.3 to push/install a new APK. Disabling the build cache with the setting in gradle.properties does not help either.

For my projects I disabled instant run because they use native libraries and support older Android versions. I tried to enable instant run (just for fun) and of course it made things even worse.

I tried all the various settings in the configuration -> Installation setting, however no success. I also tried to invalidate AS caches and restart, also no success.

Of course I update the gradle Android plugin to 2.3.0, gradle version 3.3.

Because I use native libs and they have a complex setup the gradle.properties file has this setting:
android.useDeprecatedNdk=true

I tried to use the new native build stuff in Android's gradle plugin, again no success.

Just for info: after a build I often (always?) see a short "gradle sync in progress..." or the info that gradle file were changed and a sync is necessary, however I haven't changed gradle scripts at all, just cleaned the build cache.

Any ideas what to set and to force AS 2.3 to push/install a new APK every time to the device?


Post has attachment
Question regarding CMake and ndk-build support in AS 2.2

I'm just evaluating this new feature and try to link an existing NDK project to the gradle build. Works well, fairly easy :-) . However, before the NDK build should run I need to setup some other stuff that's required by the NDK script (Android.mk).

In gradle we can easily do this using a construct like this:

android {
...
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn someFunction
}
}

Thus can I do the same for ndkBuild? What's the task type if I have the following fairly simple setup, thus what to use instead of 'JavaCompile' above:

externalNativeBuild {
ndkBuild {
path "jni/Android.mk"
}
}

Maybe +Tor Norbye can shed some light on this. Thanks

Post has attachment
Solving some mysteries about Android's camera2 API, YUV and RGB
Recently I had to enhance an existing client to use Android's camera2 API to do video calls.  The existing implementation uses the old camera API, got the data in the YUV NV21 format, converted it to RGB and handed it over to the codec which produced the vi...

Post has attachment
Recently I added the camera2 API to an existing video app and had to convert the camera's YUV data to ARGB.

While solving the problem I found some issues with the YUV format and how to access it, in a next step I used RenderScript to speed up the image data processing and get ARGB data at full speed.

See the blog posts for more details and some example code.

Post has attachment
Recently I added the camera2 API to an existing video app and had to convert the camera's YUV data to ARGB. The new camera2 API is very different from the old API and I needed to start from scratch, more or less.

While solving the problem I found some issues with the YUV format and how to access it, in a next step I used RenderScript to speed up the image data processing and get ARGB data at full speed.

See the blog posts for more details and some example code.

+Alex Ruiz  After updating to AS 0.9.3 I get some wrong error indications. The most annoying is this:
if (!TextUtils.equals(currentDirectoryPath, oldDirectoryPath)) ...

In this case AS tells me:

Non-static method 'equals(java.lang.Object)' cannot be referenced from a static context.

The same issue here which is really strange:

notificationManager.notify(NotificationImportExportListener.FAILURE_NOTIFICATION_TAG, FAILURE_NOTIFICATION_ID,
                notification);

In this case 'notificationManager' holds Android's NotificationManager and this has a "notify" method. However, java.lang.Object also has a 'notify' method and AS takes this and issues an error because of non-matching arguments. 

I never saw this before. I closed the project, closed AS, restarted it, open the project - problem persists. What was changed in 0.9.3 to trigger this behaviour? Anything I missed to do? The build works without problems, also the application works as expected :-)

I stepped back to 0.9.2 and the problem is gone without any changes on the project files. 

I have a project with an 'src/AndroidTest'  sub-directory that hosts the unit tests. It uses the standard directory structure. My test classes extend the 'AndroidTestCase' class. Thus a pretty simple setup :-) .

For some test cases I like to use some PNG image files to check graphic processing. I have a  R.drawable.my_big_image and the test case can read the PNG file using 'getContext().getResources().openRawResource(R.drawable.my_big_image ) if I store the PNG file in the normal res/drawable folder (the main project's folders).

If I store the PNG fle inside the src/AndroidTest/res/drawable the test case is not able to read the file correctly.

What's the setup to store and access PNG files for test cases only? I don't want't to have the test resources in the main project's resources. Any ideas on this?

+Alex Ruiz  I'm using AS 0.8.1, beta channel, and try to get some device screen shots from a connected (via USB) device. This used to work in previous versions/builds of AS. Now I get the following error message from my beloved AS:

Unexpected error while obtaining screenshot: java.lang.IllegalStateException:@NotNull method com/android/tools/idea/ddms/screenshot/DeviceArtDescriptor.getArtDescriptor must not return null

Is it a known problem? The connected devices are Nexus 4 (4.4.3) or Nexus 5 (4.4.4)

+Xavier Ducrohet  - After updating to AS 0.8 and the '20' releases I get some warning in gradle.build:

productFlavors' cannot be applied to '(groovy.lang.Closure<com.android.builder.core.DefaultProductFlavor>)' 

The build as such works, for all variants. Seems like an incorrect warning.

These are the relevant parts of build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19

    ... some more definitions
   }
       productFlavors {
        devtest {
            applicationId "com.myapp.app_devtest"
        }
Wait while more posts are being loaded