Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by milad1987 · Jan 05, 2017 at 06:16 PM · unity 5jni

get context of activity for android dont work in unity 5.4 please help

hi. i use this code for get signature hash code:

 #if UNITY_EDITOR
         return true;
         #endif
 
         // 获取Android的PackageManager
         AndroidJavaClass Player = new AndroidJavaClass ("com.unity3d.player.UnityPlayer");
         AndroidJavaObject Activity = Player.GetStatic<AndroidJavaObject> ("currentActivity");
 
         AndroidJavaObject PackageManager = Activity.Call<AndroidJavaObject> ("getPackageManager");
 
         // 获取当前Android应用的包名
         string packageName = Activity.Call<string> ("getPackageName");
 
         // 调用PackageManager的getPackageInfo方法来获取签名信息数组
         int GET_SIGNATURES = PackageManager.GetStatic<int> ("GET_SIGNATURES");
         AndroidJavaObject PackageInfo = PackageManager.Call<AndroidJavaObject> ("getPackageInfo", packageName, GET_SIGNATURES);
         AndroidJavaObject[] Signatures = PackageInfo.Get<AndroidJavaObject[]> ("signatures");
 
         // 获取当前的签名的哈希值,判断其与我们签名的哈希值是否一致
         if (Signatures != null && Signatures.Length > 0)
         {
             int hashCode = Signatures [0].Call<int> ("hashCode");
             //hashlabel.GetComponent<UILabel> ().text = "hash " + hashCode;
             Debug.Log ("signatooooooooooooooor  " + hashCode);
             return hashCode == 8888888888;//我们签名的哈希值
 
         }
         return false;
 

but when i run it i got this error:

 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: static jfieldID 0x70fcce68 not valid for class java.lang.Class<android.app.ApplicationPackageManager>: com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]     in call to GetStaticIntField: com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]     from boolean com.unity3d.player.UnityPlayer.nativeRender(): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65] "UnityMain" prio=5 tid=14 Runnable: com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x12c02f90 self=0xb8894ea8: com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   | sysTid=5893 nice=0 cgrp=default sched=0/0 handle=0xa3f9f000: com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   | state=R schedstat=( 3569250003 396440721 5906 ) utm=321 stm=35 core=1 HZ=100: com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   | stack=0xa3e9d000-0xa3e9f000 stackSize=1036KB: com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   native: #00 pc 0000484c  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   native: #01 pc 00003031  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   native: #02 pc 00243b8b  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*, BacktraceMap*)+70): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   native: #03 pc 002282af  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+154): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   native: #04 pc 000b00dd  /system/lib/libart.so (art::JniAbort(char const*, char const*)+584): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   native: #05 pc 000b0825  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   native: #06 pc 000b7147  /system/lib/libart.so (art::CheckJNI::GetStaticIntField(_JNIEnv*, _jclass*, _jfieldID*)+274): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   native: #07 pc 00aabc58  /mnt/asec/com.milad.olfat-2/lib/arm/libunity.so (AndroidJNI_CUSTOM_GetStaticIntField(void*, void*)+200): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   native: #08 pc 00004294   (???): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   at com.unity3d.player.UnityPlayer.nativeRender(Native method): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   at com.unity3d.player.UnityPlayer.a(unavailable:-1): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   at com.unity3d.player.UnityPlayer$b$1.handleMessage(unavailable:-1): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   at android.os.Handler.dispatchMessage(Handler.java:98): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   at android.os.Looper.loop(Looper.java:211): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65]   at com.unity3d.player.UnityPlayer$b.run(unavailable:-1): com.milad.olfat
 01-05 18:06:32.739  5868  5893 F art     : art/runtime/check_jni.cc:65] : com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295] Runtime aborting...: com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295] Aborting thread:: com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295] "UnityMain" prio=5 tid=14 Native: com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   | group="" sCount=0 dsCount=0 obj=0x12c02f90 self=0xb8894ea8: com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   | sysTid=5893 nice=0 cgrp=default sched=0/0 handle=0xa3f9f000: com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   | state=R schedstat=( 3611780367 409153744 6009 ) utm=324 stm=37 core=1 HZ=100: com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   | stack=0xa3e9d000-0xa3e9f000 stackSize=1036KB: com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   | held mutexes= "abort lock" "mutator lock"(shared held): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #00 pc 0000484c  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #01 pc 00003031  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #02 pc 00243b8b  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*, BacktraceMap*)+70): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #03 pc 002282af  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+154): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #04 pc 0021825d  /system/lib/libart.so (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread*)+24): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #05 pc 0021850d  /system/lib/libart.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+436): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #06 pc 002186e1  /system/lib/libart.so (art::Runtime::Abort()+72): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #07 pc 000a65bb  /system/lib/libart.so (art::LogMessage::~LogMessage()+1322): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #08 pc 000b02cb  /system/lib/libart.so (art::JniAbort(char const*, char const*)+1078): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #09 pc 000b0825  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #10 pc 000b7147  /system/lib/libart.so (art::CheckJNI::GetStaticIntField(_JNIEnv*, _jclass*, _jfieldID*)+274): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #11 pc 00aabc58  /mnt/asec/com.milad.olfat-2/lib/arm/libunity.so (AndroidJNI_CUSTOM_GetStaticIntField(void*, void*)+200): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   native: #12 pc 00004294   (???): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   at com.unity3d.player.UnityPlayer.nativeRender(Native method): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   at com.unity3d.player.UnityPlayer.a(unavailable:-1): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   at com.unity3d.player.UnityPlayer$b$1.handleMessage(unavailable:-1): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   at android.os.Handler.dispatchMessage(Handler.java:98): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   at android.os.Looper.loop(Looper.java:211): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295]   at com.unity3d.player.UnityPlayer$b.run(unavailable:-1): com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295] Dumping all threads without appropriate locks held: thread list lock mutator lock: com.milad.olfat
 01-05 18:06:32.776  5868  5893 F art     : art/runtime/runtime.cc:295] : com.milad.olfat
 
 

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

using shared libraries generated by Android project in Unity 0 Answers

LookRotation over a local axis 0 Answers

[Model] Imported Model - Resets to random rotation upon Play Mode 0 Answers

How i can add a range for each DNA sliders in the UMA assets ,How can I add range value for each DNA slider in o3n male and female uma assets 0 Answers

Build failed with errors? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges