Friday, December 27, 2019

Eclipse Subversive (SVN) plugin installation

A tutorial on how to install Subversive SVN plugin + connectors for those who still use SVN as a source repository for their projects or used to easily pull into your project the Google AAR libraries from GitHub.

  1. Use your exiting Eclipse installation or download and extract the latest version available.
    Eclipse IDE for Java Developers 2019-12
    https://www.eclipse.org/downloads/packages/

  2. Go to Help > Install New Software
    Click Add... button a add a new Subversive repository pointing to
    http://download.eclipse.org/technology/subversive/4.0/update-site/


    Select at least the Subversive SVN Team Provider entry, continue de installation with the Next button, accept the license and Finish the installation.


    Restart now when prompted, to apply the software updates.

  3. Once restararted, go to Windows > Preferences > Team > SVN and select the SVN Connector tab.


    SVN Connector dropdown is empty so let's click the Get Connectors... button to download a connector.

    You can choose between the SVN Kit pure Java connector (SVN 1.8 compatible) and Native JavaHL system binary connectors (SVN 1.8 and 1.9 compatible). I for one prefer the first one as it - read this thread if you want to better understand the differences. https://stackoverflow.com/a/7703748/308836


    Finish the installation following the software updates dialogs presented, accepting the license and choose to Install Anyway if presented wih a dialog telling you the software was not signed.


    Restart now when prompted, to apply the software updates.
* * *

And that's it, you can now pull projects down from SVN using File > Import... > SVN > Projects from SVN




Sunday, December 8, 2019

Eclipse Android Manifest merger

The Android manifest merger is available starting with SDK Tools, Revision 20 (June 2012) and it merges your application AndroidManifest.xml with the AndroidManifest.xml's defined in the libraries added to your application.
General notes:
  • Build system
    • Added automatic merging of library project manifest files into the including project's manifest. Enable this feature with the manifestmerger.enabled property.

Also checkout the Google I/O 2012 - What's New in Android Developers' Tools starting at 48:59




Here is an example with dandar3/android-google-play-services-ads 18.3.0 library added to your application.

1. Your application.properties:
...
target=android-28
manifestmerger.enabled=true
android.library.reference.1=../google-play-services-ads

2. Your AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    package="com.example.googleplayservices.ads"
    android:versioncode="1"
    android:versionname="1.0">

    <uses-sdk
        android:minsdkversion="15"
        android:targetsdkversion="29">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE">
    <uses-permission android:name="android.permission.INTERNET">

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name">
        <activity
            android:label="@string/app_name"
            android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-3940256099942544~3347511713" />

    </application>   

</manifest>

3. Check out the resulting bin\AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.example.googleplayservices.ads">

    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="29"/>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application android:allowBackup="false" android:icon="@drawable/ic_launcher" android:label="@string/app_name">
        <activity android:label="@string/app_name" android:name="com.example.googleplayservices.ads.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713"/>

        <!-- Include the AdActivity and InAppPurchaseActivity configChanges and themes. -->
        <activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:exported="false" android:name="com.google.android.gms.ads.AdActivity" android:theme="@android:style/Theme.Translucent"/>

        <provider android:authorities="com.example.googleplayservicesads.mobileadsinitprovider" android:exported="false" android:initOrder="100" android:name="com.google.android.gms.ads.MobileAdsInitProvider"/>
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>

    </application>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>    

</manifest>

Tuesday, September 17, 2019

ADB.exe crashing 0xc000005 on winusb.dll

An issue I've had on my work laptop with adb.exe crashing with 0xc000005 for last couple of months, I finally managed to fix it today after several attempts in various ways.


Monitoring the process with Process Monitor would reveal that is crashes after working with WINUSB.dll (ignore the highlight in blue, that was on the first attempt checking, the file should not be there)


SFC scan shows no problems with the file.
sfc /SCANFILE=C:\Windows\SysWOW64\winusb.dll

Trying the same Android SDK installation in the Windows Sandbox VM shows it working correctly, so it must be something on my physical system. The winusb.dll files on both systems show the same version, although on copying to the phyical system in te mporary location and comparing with FC /B clearly shows differences.

Now with the new version of SysWow64\winusb.dll at hand, I would try to replace the original on the physical system without success as it is owned and protected by Trusted Installer service.

Searching the web for a tool that would allow to run a process (e.g. cmd.exe or explorer.exe) as TrustedInstaller user found ExecTI from WinAero.


This would allow me to rename the old file and copy the new one in from the clean Sandbox image.

cd /D %WINDIR%\SysWow64
rename winusb.dll winusb.dll.BROKEN
copy WHERE_YOU_COPIED_IT_FROM_SANDBOX\winusb.dll winusb.dll

Running ADB again would show it working succesfully now!

adb --version
Android Debug Bridge version 1.0.41
Version 29.0.4-5871666
Installed as D:\Program Files\Android\android-sdk\platform-tools\adb.exe