Profile

Cover photo
Werner Dittmann
Works at Self-employed
Lived in München
50,077 views
AboutPostsPhotosVideos

Stream

Werner Dittmann

Android Studio  - 
 
+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. 
1
Alex Ruiz's profile photo
 
This is a known issue ( https://code.google.com/p/android/issues/detail?id=79420 ). I couldn't reproduce it myself using the latest code (which has not been released yet) and JDKs 1.6, 1.7 and 1.8. I suspect this bug has been already fixed by +Denis Zhdanov. 
Add a comment...

Werner Dittmann

Android Studio  - 
 
+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)
1
Alex Ruiz's profile photoTor Norbye's profile photoWerner Dittmann's profile photo
3 comments
 
Thanks. I think I can wait for 0.8.2 :-) .
Add a comment...

Werner Dittmann

Gradle Build System  - 
 
+Xavier Ducrohet 
In a project I've created build flavors and copied the manifest into the right location of the flavor directory. The idea is that gradle merges this manifest with the main manifest. Unfortunately that doesn't work. I get the error message:
'Trying to merge incompatible /manifest/application/provider'

I just try to have another android:authorities string in the manifest to avoid a provider authorities clash if I install various flavors.

I found a very old posting in Google groups (May 2013, https://groups.google.com/forum/#!msg/adt-dev/K29pY0H9vsY/MXdu0CGj6SwJ ) where Xavier said that they haven't looked into 'provider merging' but will be soon :-) .

Seems that this is not yet fixed? If I'm not mistaken it is not possible to define the provider authority otherwise because the Android PM checks this during package installation. Any ideas about this topic?
The issue I'm seeing is that our provider elements have to have unique android:authorities which we typically made the package name suffixed with the authority name. This ensures that the authorities are unique and 2 flavors of the same app can be installed side by side.
1
Xavier Ducrohet's profile photo
 
Looks like you have the same provider node in both the main manifest and the one from the flavor? Just remove the one from the main manifest. Right now we can't merge the nodes if they are not exactly the same. This is something we are now actively working on.
Add a comment...
 
In one of my projects I sub-class ImageView. AS shows a warning for the implementation of the onDraw(Canvas canvas) function:

'Not annotated parameter overrides @NotNull parameter '

How to solve this (except by disabling the waring at all :-) )?. I've checked the onDraw functions in ImageView and View and do not see any annotations, also some info on a IntelliJ page (https://www.jetbrains.com/idea/documentation/howto.html) does not give a real answer.

Any idea?
2
2
Werner Dittmann's profile photoCristian Garcia's profile photo
Add a comment...

Werner Dittmann

Android Studio  - 
 
Did AS 0.4.0 changed the way it calls gradle to build APK?

In my build.gradle I use this:

    buildTypes {
        debug {
        }

        develop {
            initWith debug
            signingConfig signingConfigs.sc
            zipAlign true
        }

        alpha {
            initWith release
            signingConfig signingConfigs.sc
            zipAlign true
        }
    }

and AS used to build 'debug' APK when I edited some source and load it to the device. Sine 0.4.0 AS builds the 'alpha' APK and loads it. During development I like to have the 'debug' :-) .

Where can I set / configure AS to build the 'debug' APK? I looked around in the various settings etc but did not found where to configure this. Or is this something I need to add to 'build.gradle'?
1
Scott Culverhouse (lilHermit)'s profile photoWerner Dittmann's profile photoNik Clayton's profile photo
3 comments
 
Towards the bottom left of the AS UI should be a docked "Build Variants" button.  Press it, and a panel to choose the build variant pops out.
Add a comment...

Werner Dittmann

Shared publicly  - 
 
Next test :-) 
I removed the support lib dependency from the main build.gradle and the error message was gone.

Next I had a subtle error in my main build.gradle. I have additional libs and I wrote it this way:

compile files(':libs/guava-14.0.1.jar')

No error or warning during the build but the classes from jar were somehow not included in the APK. I removed colon before libs, did a gradlew clean and then an assembleDebug. Now the APK seems to be OK, a first test was OK as well. Calling assembleDebug after modification of build.gradle didn't help, only after I called clean and assembled again.

I'm too new to gradle to get all the subtle differences when writing the rules, but this one really gave me some headaches :-)
1
Werner Dittmann's profile photoFelix Homann's profile photo
3 comments
 
+Werner Dittmann Thanks!
Add a comment...

Werner Dittmann

Gradle Build System  - 
 
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?
1
Marty Glaubitz's profile photo
 
The AndroidTest dir is not a normal project dir i think - thus cannot host resourced
Add a comment...

Werner Dittmann

Gradle Build System  - 
 
+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"
        }
2
Eric Labelle's profile photoWerner Dittmann's profile photoBenson Lott's profile photoJigar Brahmbhatt's profile photo
5 comments
 
Is there any solution to this ?
Add a comment...

Werner Dittmann

Discussion  - 
 
 
In one of my projects I sub-class ImageView. AS shows a warning for the implementation of the onDraw(Canvas canvas) functions:

'Not annotated parameter overrides @NotNull parameter '

How to solve this (except by disabling the waring at all :-) )?. I've checked the onDraw functions in ImageView and View and do not see any annotations, also some info on a IntelliJ page (https://www.jetbrains.com/idea/documentation/howto.html) does not give a real answer.

Any idea?
1
Siva Velusamy's profile photoWerner Dittmann's profile photo
2 comments
 
I tried that in my sub-class, however, AS tells that it does not know about @NotNull. I suspect that I'm missing the annotation JAR or class, similar to the android.annotation.TargetApi class. What should I use here? Any configuration in AS?
Add a comment...

Werner Dittmann

Discussion  - 
 
After the update to AS 0.4.2 I noticed a few new files in the .idea/libraries directory. These files have a 'Gradle__' prefix.

- some of these files mirror already existing (similar) files. The new files seem to add 'Gradle: ' to the 'name' tag. 
- at least one file (Gradle__support_v4_19_0_0.xml) adds a local path: jar://$USER_HOME$/android-sdk-linux_86/... . M project does not use support-v4 directly, only appcompat-v7 which pulls support-v4 via the local maven repository.

Some questions:
What's the purpose of these files?
According to IntelliJ docs files in this directory should go into a VCS. However, if a files contains a local path then this is not a good idea, isn't it?
Because AS seems to add files into '.idea': which AS files should go into a VCS? 
1
Alex Ruiz's profile photoAlan Daly's profile photo
2 comments
 
+Alex Ruiz  love the fact that you link your fixes the way you do, as a novice I learn so much from seeing an issue like this from inception, to fix and see not only what happened, but why it happened and how it was fixed, thank you!
Add a comment...

Werner Dittmann

Discussion  - 
 
I think I've found a C compiler / optimizer problem in Android NDK. I use 'android-ndk-r8e-linux-x86_64'. The compiled code crashes with a SIGBUS (Signal 7), code 1 and this indicates some alignment problems with pointers/addresses. The pointers may hold odd addresses (char*).

If I use the pointers right before the offending C-statement, for example call a dummy function with the pointers as arguments, then everything works fine afterwards. Without changing the offending C-statement It seems that the optimizer in one case produces code that requires even addresses, while this is not the case otherwise.

I'm not the big master on ARM assembler code, thus I just browsed the assembler code and saw differences how the offending C-statement is compiled.

The same C code works on X86 (Linux) without problems (compiled with GCC).

I've created a very small project that includes the C files and the Android.mk and gradle build files. The application crashes on my Nexus 4 (not tested with other devices yet).

Thus my question: how and where to report this problem? Thanks.
1
Siva Velusamy's profile photo
Add a comment...

Werner Dittmann

Shared publicly  - 
 
Felix,

I've tried the gradle scripts as shown in your description and got an error because the build run includes the support lib twice. 

If I leave out the support lib from the main build.gradle then the APK is not built correctly, at least not in my environment which is very similar to what you use.
1
Werner Dittmann's profile photoFelix Homann's profile photo
4 comments
 
+Werner Dittmann I've seen this error too when I tried to import an Eclipse project. I don't remember how I fixed it but it was either:

1. Update the support library in each of your Eclipse projects before exporting, so they all have the same version.

or

2. Let just the main project depend on the support library.
Add a comment...
Work
Occupation
IT Consultant and Systemprogrammer
Employment
  • Self-employed
    2013 - present
    Working as IT consultant and system programmer for Linux and Android mainly in security related areas. Recently I did a lot of Android consulting and implementations.
  • Nokia Siemens Networks
    Senior Solution Architect, 2007 - 2012
  • Digital Equipment Corporation
    Senior Systemprogrammer, 1978 - 1981
  • Siemens AG
    Senior Systemprogrammer, 1986 - 2007
Basic Information
Gender
Male
Relationship
Married
Story
Introduction
Well, working on various open source projects, mostly security oriented projects. 

My current main project is the implementation of ZRTP (RFC6189) for various communication clients. My GNU ZRTP implementation was tested to work with Phil Zimmermann's ZRTP implementation (Phil invented ZRTP). GNU ZRTP comes in several flavours:
  • GNU ZRTP C++: available for GNU ccRTP (Twinkle SIP client uses this) 
  • GNU ZRTP4J: available for Java/JMF (Jitsi comminication client uses this)
  • GNU ZRTP4PJ: a C wrapper around the C++ classes, available for PJSIP/PJSUA, some clients use this, most prominent is CSipSimple for Android.
Some interesst to implement cryptographic stuff, for example Skein and Threefish for Java and Google's Go language and added a simple to use C API for Skein and Threefish.

Another project I did: started the WebService Security project for Java (WSS4J) at Apache (a long time ago :-) ) together with Davanum Srinivas.
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Previously
München
Links