I'm trying to get Android-YouTube-Player to work in a B4A project.
It's an Activity that plays You Tube videos - handling many tasks automatically.
It chooses a video quality that matches the device's internet connection speed for example.
You can download a compiled JAR library and/or the source code.
So i thought it'd be easy enough to download the compiled JAR and get it working...
I created a new B4A project:
Updated the manifest:
And created a simple library class to generate an Intent to test with:
The downloaded JAR is OpenYouTubeActivity.jar and is in my additional libraries folder.
Everything compiles with no errors but a click on Button1 raises an exception
uk.co.martinpearman.b4a.youtubeplayeractivitydemo/com.keyes.youtube.OpenYouTubePlayerActivity cannot be found.
I've also downloaded the source code and built the library so that it contains all the OpenYouTubeActivity classes - no need for DependsOn and the separate JAR file.
The error is the same - activity not found.
Any ideas where i'm going wrong?
Martin.
It's an Activity that plays You Tube videos - handling many tasks automatically.
It chooses a video quality that matches the device's internet connection speed for example.
You can download a compiled JAR library and/or the source code.
So i thought it'd be easy enough to download the compiled JAR and get it working...
I created a new B4A project:
B4X:
'Activity module
Sub Process_Globals
End Sub
Sub Globals
Dim Button1 As Button
Dim YouTubePlayerActivity As B4AOpenYouTubeActivity
End Sub
Sub Activity_Create(FirstTime As Boolean)
Button1.Initialize("Button1")
Button1.Text="Start You Tube player"
Activity.AddView(Button1, 25%x, 25%y, 50%x, 50%y)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
StartActivity(YouTubePlayerActivity.CreateIntent)
End Sub
Updated the manifest:
B4X:
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddApplicationText(<activity android:name="com.keyes.youtube/.OpenYouTubePlayerActivity" />)
And created a simple library class to generate an Intent to test with:
B4X:
@ActivityObject
@Author("Me")
@DependsOn(values = { "OpenYouTubeActivity" })
@ShortName("B4AOpenYouTubeActivity")
@Version(1.00f)
public class B4AOpenYouTubeActivity {
public Intent CreateIntent(BA pBA){
Intent intent1 = new Intent(null, Uri.parse("ytv://t56cHZymmvs"), pBA.context, OpenYouTubePlayerActivity.class);
return intent1;
}
}
The downloaded JAR is OpenYouTubeActivity.jar and is in my additional libraries folder.
Everything compiles with no errors but a click on Button1 raises an exception
android.content.ActivityNotFoundException: Unable to find explicit activity class {uk.co.martinpearman.b4a.youtubeplayeractivitydemo/com.keyes.youtube.OpenYouTubePlayerActivity}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
at android.app.Activity.startActivityForResult(Activity.java:2827)
at android.app.Activity.startActivity(Activity.java:2933)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:665)
at uk.co.martinpearman.b4a.youtubeplayeractivitydemo.main._button1_click(main.java:231)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:143)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:131)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:127)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:49)
at android.view.View.performClick(View.java:2506)
at android.view.View$PerformClick.run(View.java:9112)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
android.content.ActivityNotFoundException: Unable to find explicit activity class {uk.co.martinpearman.b4a.youtubeplayeractivitydemo/com.keyes.youtube.OpenYouTubePlayerActivity}; have you declared this activity in your AndroidManifest.xml?
uk.co.martinpearman.b4a.youtubeplayeractivitydemo/com.keyes.youtube.OpenYouTubePlayerActivity cannot be found.
I've also downloaded the source code and built the library so that it contains all the OpenYouTubeActivity classes - no need for DependsOn and the separate JAR file.
The error is the same - activity not found.
Any ideas where i'm going wrong?
Martin.
Last edited: