AWS Cognito for Android fails on ...getClassLoader().getResourceAsStream(...);

I’m writing a Unity wrapper for Amazon’s Cognito cloud saving platform for a game I’m working on; the problem is, Amazon has a versionInfo.properties file in their aws-android-sdk-2.0.5-core.jar file which it references with the Java code: (there was no Java option for insert code, but CSharp is close enough)

package com.amazonaws.util;
...
public class VersionInfoUtils {
...
    private static final String VERSION_INFO_FILE = "com/amazonaws/sdk/versionInfo.properties";
    private static String version = null;
    private static String platform = null;
...
    private static void initializeVersion() {
        InputStream inputStream = VersionInfoUtils.class.getClassLoader().getResourceAsStream(VERSION_INFO_FILE);
        Properties versionInfoProperties = new Properties();
        try {
            if (inputStream == null)
                throw new Exception(VERSION_INFO_FILE + " not found on classpath");
            versionInfoProperties.load(inputStream);
            version = versionInfoProperties.getProperty("version");
            platform = versionInfoProperties.getProperty("platform");
        } catch (Exception e) {
            log.info("Unable to load version information for the running SDK: " + e.getMessage());
            version = "unknown-version";
            platform = "java";
        }
    }
...

I see this in the logs:

08-15 10:07:13.940: I/VersionInfoUtils(17270): Unable to load version information for the running SDK: /com/amazonaws/sdk/versionInfo.properties not found on classpath
08-15 10:07:14.120: W/dalvikvm(17270): Exception Ljava/lang/IllegalArgumentException; thrown while initializing Lcom/amazonaws/internal/config/InternalConfig$Factory;

Which is pretty clear that it’s not finding the versionInfo.properties file, and then appears to throw an Exception.
Going to Google, I found this:

Which appears to be my problem, so I tried exporting an android project instead of having Unity handle the build, which worked! BUT, this isn’t exactly sustainable; it proved a concept, that it was possible, but we are using automated build tools like TeamCity and we switched to using Unity partially for it’s slick cross platform building process.

So, my question is this:
Is there a way to change Unity’s Dex compilation to not strip out non-class files from a jar?
Or is there some other cool solution I don’t even know about?

Hey JkRantz,

We ran into the same problem on our game when we were using Adobe AIR, and basically the solution I went with was adding a post-process step, which I detailed on the Amazon forum, Forums | AWS re:Post.

Basically,

We’re only starting our new game with Unity, but we’re absolutely going to be taking the same approach now.

Hope this helps!