我使用kotlin在Intellij Idea中實現了一個項目。這是沒有錯誤的工作。這是沒有錯誤Android工作室找不到java.math.BigInteger項目中的一些方法
我的IntelliJ項目的照片,但是當我執行Android Studio中這個項目中,我得到了錯誤,因爲該工作室找不到的BigInteger類
這種方法longValueExact()
的Android Studio項目的照片:
我有一個JDK在我的電腦(v 1.8)。但在Itellij項目這個方法工作,並在android工作室沒有工作。
我打開在Android Studio中java.math.BigInteger中的類,看到longValueExact()方法:
open class AuthKey(val key: ByteArray) {
constructor(key: ByteBuffer) : this(key.array())
init {
if (key.size != 256)
throw RuntimeException("AuthKey must be 256 Bytes found ${key.size} bytes")
}
// see https://core.telegram.org/mtproto/description#key-identifier
// SHA1 generates 20 bytes long hash, authKeyId is the lower 8 bytes
val keyId = CryptoUtils.substring(CryptoUtils.SHA1(key), 12, 8)
fun getKeyIdAsLong() = BigInteger(keyId).longValueExact()
}
class TempAuthKey(key: ByteArray, val expiresAt: Int) : AuthKey(key)
這意味着我們在Java 1.8有這樣的班級,我們加入這在android工作室。和android工作室加載這個類與外部庫中的所有方法。但我們不能在項目類中使用這些方法!
任何人都可以幫助我嗎?
請添加代碼,而不是附加圖像。 –
我加了代碼 – b4hr4m