build java+kolin library with build.bp failed

77 views
Skip to first unread message

Ted Jiang

unread,
Mar 12, 2019, 1:07:43 AM3/12/19
to Android Building
this is my build.bp: 

java_library_static {
    name: "mylib",

    srcs: [
        "*.java",
        "*.kt",
        "**/*.java",
        "**/*.kt",
    ],

    
    optimize: {
        enabled: false,
    },

}


but it yields very strange errors when building, like:

SysProperty.kt:9:16: error: type mismatch: inferred type is java.lang.String! but kotlin.String was expected
        return SystemProperties.get(key)
               ^
SysProperty.kt:9:33: error: cannot access class 'java.lang.String'. Check your module classpath for missing or conflicting dependencies
        return SystemProperties.get(key)
                                ^
SysProperty.kt:9:37: error: type mismatch: inferred type is kotlin.String but java.lang.String! was expected
        return SystemProperties.get(key)
                                    ^
SysProperty.kt:14:16: error: type mismatch: inferred type is java.lang.String! but kotlin.String was expected
        return SystemProperties.get(key, def)
               ^
SysProperty.kt:14:33: error: cannot access class 'java.lang.String'. Check your module classpath for missing or conflicting dependencies
        return SystemProperties.get(key, def)
                                ^
SysProperty.kt:14:37: error: type mismatch: inferred type is kotlin.String but java.lang.String! was expected
        return SystemProperties.get(key, def)
                                    ^
SysProperty.kt:14:42: error: type mismatch: inferred type is kotlin.String but java.lang.String! was expected
        return SystemProperties.get(key, def)
                                         ^
SysProperty.kt:19:33: error: cannot access class 'java.lang.String'. Check your module classpath for missing or conflicting dependencies
        return SystemProperties.set(key, value)
                                ^

TelephonyMgr.kt:11:48: error: cannot access class 'java.lang.Object'. Check your module classpath for missing or conflicting dependencies
            getContext().getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
                                               ^
TelephonyMgr.kt:11:48: error: cannot access class 'java.lang.String'. Check your module classpath for missing or conflicting dependencies
            CoreApi.getInstance().getContext().getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
                                

It looks like some standard java classes are missing, such as java.lang.String, java.lang.Object,  but why? 


Dan Willemsen

unread,
Mar 12, 2019, 2:00:13 AM3/12/19
to Android Building
I'm not sure what's happening here, but a few questions/comments:

What Android version are you using?

    srcs: [
        "*.java",
        "*.kt",
        "**/*.java",
        "**/*.kt",
    ],

This will duplicate the list of java and kotlin files in the current directory, since ** will match both the current directory and all subdirectories. I can't see how that would cause this problem, but it's a good thing to clean up.

- Dan

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ted Jiang

unread,
Mar 13, 2019, 2:30:49 AM3/13/19
to Android Building
I build on Android 9 AOSP.
removing the redundant doesn't help, the errors still exist.
Reply all
Reply to author
Forward
0 new messages