2014-03-25 1 views
1

android openFileChooser 메서드에서 문제가 있습니다. 이클립스를 사용하여 adb를 통해 휴대 전화 (안드로이드 4.0.3을 사용하는 samsung galaxy s3)에 설치하면 잘 작동합니다. 그러나 ecplise에서 서명 된 apk를 내 휴대폰에 설치하면 openFileChooser 메소드가 호출되지 않습니다. android openfilechooser 메서드가 서명 된 apk에서 호출하지 않습니다.

을 내 HTML 코드 : 이클립스

input type='file' name='files[]' multiple accept='image/*' 

내 코드 :

private class mainWebChromeClient extends WebChromeClient { 

     @SuppressWarnings("unused") 
     public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) { 
      openFileChooser(uploadMsg); 
     } 

     @SuppressWarnings("unused") 
     public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) { 
      openFileChooser(uploadMsg); 
     } 

     public void openFileChooser(ValueCallback<Uri> uploadMsg) { 

       final List<Intent> cameraIntents = new ArrayList<Intent>(); 
       final Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 
       File externalDataDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); 
       File cameraDataDir = new File(externalDataDir.getAbsolutePath()+File.separator+"vast_manager_camera"); 
       if(!cameraDataDir.exists()){ 
        cameraDataDir.mkdirs(); 
       } 

       filePath = cameraDataDir.getAbsolutePath()+File.separator+System.currentTimeMillis()+".jpg"; 
       Uri imageUri = Uri.fromFile(new File(filePath)); 

       final PackageManager packageManager = getPackageManager(); 
       final List<ResolveInfo> listCam = packageManager.queryIntentActivities(captureIntent, 0); 

       final Intent intent = new Intent(captureIntent); 

       for(ResolveInfo res : listCam) { 
        final String packageName = res.activityInfo.packageName; 
        intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name)); 
        intent.setPackage(packageName); 
        intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); 
        cameraIntents.add(intent); 

       } 


       VastActivity.mUploadMessage = uploadMsg; 

       Intent i = new Intent(Intent.ACTION_GET_CONTENT); 

       i.addCategory(Intent.CATEGORY_OPENABLE); 
       i.setType("image/*");    
       Intent chooserIntent = Intent.createChooser(i,"Image Chooser"); 

       chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[]{})); 
       VastActivity.this.startActivityForResult(chooserIntent, FILECHOOSER_RESULTCODE); 

     } 
} 

나는이 문제를 몇 일에 대한 투쟁을 가지고 있지만, 아무 생각이 (TT)을 해결하지 위해, 사람이 좀 도와주세요 그것을 해결하기 위해. 당신이 다음 난독을 사용했던 방법 "openFileChooser은"다소 난독 화 될 수있는 경우

답변

1

, 추가

-keep 클래스 * 확장 android.webkit. * 당신의 난독의 설정에

볼려고 도움이된다면 :)

1

나는 같은 문제가있다. 이것을 proguard-project.txt 파일에 추가하면 나를 위해 고쳐졌습니다 :

-keepclassmembers class * { 
    public void openFileChooser(android.webkit.ValueCallback,java.lang.String); 
    public void openFileChooser(android.webkit.ValueCallback); 
    public void openFileChooser(android.webkit.ValueCallback, java.lang.String, java.lang.String); 
} 
관련 문제