I have made an extension and while compiling it, I am getting this error
Cannot convert Java type ''java.lang.String[]' to Yail type
how can I fix this?
Here's the full code
I don't know if it works or not but I fell that it does not have any error
package com.blogspot.videotoaudiomanni;
import android.app.Activity;
import android.content.Context;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import java.io.File;
import it.sauronsoftware.jave.AudioAttributes;
import it.sauronsoftware.jave.Encoder;
import it.sauronsoftware.jave.EncoderException;
import it.sauronsoftware.jave.EncodingAttributes;
import it.sauronsoftware.jave.FFMPEGLocator;
import it.sauronsoftware.jave.InputFormatException;
@DesignerComponent(
version = 1,
description = "Simple Extension for conveting video to Audio by Manni",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "_")
@SimpleObject(external = true)
//Libraries
@UsesLibraries(libraries = "jave-1.0.2.jar")
//Permissions
@UsesPermissions(permissionNames = "")
public class VideoToAudio extends AndroidNonvisibleComponent {
//Activity and Context
private Context context;
private Activity activity;
public VideoToAudio(ComponentContainer container){
super(container.$form());
this.activity = container.$context();
this.context = container.$context();
}
@SimpleFunction(description = "Initialize")
public static void ConvertToAudio(String video){
File Audio =new File("/storage/emulated/0/Download/VideoTranslator/ExtractedAudio");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libmp3lame");
audio.setBitRate(new Integer(128000));
audio.setChannels(new Integer(2));
audio.setSamplingRate(new Integer(44100));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("wav");
attrs.setAudioAttributes(audio);
Encoder encoder = new Encoder();
encoder.encode(video, target, attrs);
JFileChooser fileChooser = new JFileChooser();
int response = fileChooser.showOpenDialog(null);}
@SimpleFunction(description = "Convert video to audio")
public static void main(String[] args){
File video=new File(fileChooser.getSelectedFile().getAbsolutePath());
VideoToAudio.convertToAudio(video);
}
}
Here's the error log package
Started Compiling Project VideoToAudio
Buildfile: /compiler/android/build.xmljavac:
[mkdir] Created dir: /compiler/android/build/DMxPa/classes
[javac] Compiling 1 source file to /compiler/android/build/DMxPa/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac]
[javac]
[javac] An annotation processor threw an uncaught exception.
[javac] Consult the following stack trace for details.
[javac] java.lang.IllegalArgumentException: Cannot convert Java type 'java.lang.String' to Yail type
[javac] at com.google.appinventor.components.scripts.ComponentProcessor.javaTypeToYailType(ComponentProcessor.java:2056)
[javac] at com.google.appinventor.components.scripts.ComponentDescriptorGenerator.outputParameters(ComponentDescriptorGenerator.java:367)
[javac] at com.google.appinventor.components.scripts.ComponentDescriptorGenerator.outputBlockMethod(ComponentDescriptorGenerator.java:346)
[javac] at com.google.appinventor.components.scripts.ComponentDescriptorGenerator.outputComponent(ComponentDescriptorGenerator.java:157)
[javac] at com.google.appinventor.components.scripts.ComponentDescriptorGenerator.outputResults(ComponentDescriptorGenerator.java:385)
[javac] at com.google.appinventor.components.scripts.ComponentProcessor.process(ComponentProcessor.java:1091)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:802)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:713)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1043)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1184)
[javac] at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
[javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:523)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:381)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:370)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:361)
[javac] at com.sun.tools.javac.Main.compile(Main.java:56)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javac] at java.lang.reflect.Method.invoke(Method.java:498)
[javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:57)
[javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1388)
[javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:1117)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javac] at java.lang.reflect.Method.invoke(Method.java:498)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
[javac] at org.apache.tools.ant.Task.perform(Task.java:350)
[javac] at org.apache.tools.ant.Target.execute(Target.java:449)
[javac] at org.apache.tools.ant.Target.performTasks(Target.java:470)
[javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1391)
[javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
[javac] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1254)
[javac] at org.apache.tools.ant.Main.runBuild(Main.java:830)
[javac] at org.apache.tools.ant.Main.startAnt(Main.java:223)
[javac] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
[javac] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)