Android Tutorial GameView - Create 2D Android games - Part I

squaremation

Active Member
Licensed User
Longtime User
Parse Error

I am getting message on device:

> Parse error
There is a problem parsing the package

:BangHead:
 

jaraiza

Active Member
Licensed User
Longtime User

Android 4+ or 3+?

Also... Is there anyway to implement a way to make an app to use HW acceleration depending on the OS where it is being run on?

Thanks!
 

squaremation

Active Member
Licensed User
Longtime User
Resolved example issues on older devices


Yes only this example. Remove hardwareAcceleration from manifest editor, still same error.
Unfiltered logs:
B4X:
/mnt/sdcard/temp.apk (at Binary XML file line #9): Requires newer sdk version #11 (current version is #8)
Parse error when parsing manifest. Discontinuing installation

Changed Manifest minimum sdk to 8
B4X:
<uses-sdk android:minSdkVersion="8" />

Now it will install but, Force Closes when you attempt to open

Unfiltered logs:
B4X:
If gv.IsHardwareAccelerated = False Then
java.lang.NoSuchMethodError: anywheresoftware.b4a.objects.GameViewWrapper$MyPanel.isHardwareAccelerated

OK I got it to work by:

1. Remove from Manifest Editor
B4X:
SetApplicationAttribute(android:hardwareAccelerated, "true") r
2. Change minSdkVersion to 8 in Manifest Editor
B4X:
<uses-sdk android:minSdkVersion="8" />
3. Block Comment this code in Activity_Create
B4X:
'   If gv.IsHardwareAccelerated = False Then
'      Msgbox("Hardware acceleration is not supported!!!", "")
'   End If

Then it will run on older devices YAY!
 
Last edited:

sorex

Expert
Licensed User
Longtime User
if you disable the check does that mean it will work on let's say 2.2 devices but at snail speed? or still 3.0+ only?
 

squaremation

Active Member
Licensed User
Longtime User
It make you able to use example on 2.2.
The example at least does not lag at all and runs well.
 

tekh2999

Member
Licensed User
Longtime User
HardwareAccelerated error

I'm having the same problem SetApplicationAttribute(android:hardwareAccelerate d, "true") is there
but still getting this error:

Compiling code. 0.08
Compiling layouts code. 0.05
Generating R file. Error
AndroidManifest.xml:17: error: No resource identifier found for attribute 'hardwareAccelerated' in package 'android'

I'm just using the Emulator that I set with GPU emulation and audio added to it.

can anyone help?
 
Last edited:

sterlingy

Active Member
Licensed User
Longtime User
I noticed in the sample code for GameviewSmiley, that there was a comment stating that images larger than 2048x2048 would not be drawn. Is this a limit of Android? Is there a way around this?

-Sterling
 

mjtaryan

Active Member
Licensed User
Longtime User
Very nice. Since I'm just beginning playing with games, I'm wondering how I would put GameView and the Touch Event together so that I can move game pieces via touch? Any advice would be helpful. Thanks.
 

sterlingy

Active Member
Licensed User
Longtime User

nicholas.jj.taylor

Member
Licensed User
Longtime User
Really good, but beyond my capability.... i wish i could make games.... for me to learn this i would need every line commented on

If that's true then it sounds to me as if you would be the perfect candidate to sit down with and write a game programming tutorial with.
 

Carcas

Member
Licensed User
Longtime User
I'm sorry but I'm going crazy

I created a simple app bouncy ball but it isnt' flowing. I used example for it.

I modified example to compare.

Each application has the identical parameters (timer.interval=1ms)(size=5%x)(speed 5dip)

The structures are identical but my app is islower and not smooth

help me otherwise I have to go to a psychiatrist

ps: manifest is Ok

my device is HUAWEI 300Y
 

Attachments

  • MyApp.zip
    11.3 KB · Views: 444
  • SmileModified.zip
    11 KB · Views: 422

Carcas

Member
Licensed User
Longtime User
Ok i understand thet this:

B4X:
fps = (1000 / Max(10, (DateTime.Now - lastTime)) + 20 * fps) / 21
    lblFPS.Text = NumberFormat(fps, 0, 0)
    lastTime = DateTime.Now

is necessary but i dont understand why?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…