Android Question errors when compiling with adMob V2 (Error retrieving parent for item / UNEXPECTED TOP-LEVEL ERROR:)

Kjell

Member
Licensed User
Longtime User
B4A 5.50
IDE - Process timeout: 600
Javac.exe: C:\Java\jdk1.8.0_73\bin\javac.exe
Android.jar: C:\Android\android-sdk\platforms\android-15\android.jar
B4A bridge: v2.13
Phone: Samsung Galaxy S3 (GT-I9305)
System: Android 4.4.4
Libraies: Core (v4.92) and Admob (V2.0)
Running as Debug


I get this error:

B4A version: 5.50
Parsing code. (0.00s)
Compiling code. (0.05s)
Compiling layouts code. (0.00s)
Generating R file. Error
c:\android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values-v21\appinvite_styles.xml:5: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.

If I comment out this line from Project attributes it dissapairs
B4X:
    #AdditionalRes: C:\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms

But I get a new error after the compiler showed "Convert byte code - optimized dex.":

B4A version: 5.50
Parsing code. (0.00s)
Compiling code. (0.03s)
Compiling layouts code. (0.00s)
Generating R file. (0.04s)
Compiling debugger engine code. (0.73s)
Compiling generated Java code. (1.68s)
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
at com.android.dx.rop.annotation.Annotations.<init>(Annotations.java:86)
at com.android.dx.cf.direct.AnnotationParser.parseAnnotations(AnnotationParser.java:215)
at com.android.dx.cf.direct.AnnotationParser.parseAnnotationAttribute(AnnotationParser.java:152)
at com.android.dx.cf.direct.StdAttributeFactory.runtimeInvisibleAnnotations(StdAttributeFactory.java:615)
at com.android.dx.cf.direct.StdAttributeFactory.parse0(StdAttributeFactory.java:148)
at com.android.dx.cf.direct.AttributeFactory.parse(AttributeFactory.java:96)
at com.android.dx.cf.direct.AttributeListParser.parse(AttributeListParser.java:141)
at com.android.dx.cf.direct.AttributeListParser.parseIfNecessary(AttributeListParser.java:115)
at com.android.dx.cf.direct.AttributeListParser.getEndOffset(AttributeListParser.java:96)
at com.android.dx.cf.direct.MemberListParser.parse(MemberListParser.java:213)
at com.android.dx.cf.direct.MemberListParser.parseIfNecessary(MemberListParser.java:108)
at com.android.dx.cf.direct.MethodListParser.getList(MethodListParser.java:54)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:542)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
at com.android.dx.command.dexer.Main.processClass(Main.java:749)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:672)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)

Manifest:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.


'AdMob
AddApplicationText(
<meta-data android:name="com.google.android.gms.version"
  android:value="@integer/google_play_services_version"/>
<activity android:name="com.google.android.gms.ads.AdActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

)
'End of AdMob

Project:
B4X:
#Region  Project Attributes
    #ApplicationLabel: BinCon
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: True
    #AdditionalRes: C:\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
 
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
 
    Private btnConvert As Button
    Private txtInput As EditText
    Private lblOutput As Label
    Private spnDirection As Spinner
 
    Dim AdView1 As AdView
 
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Main")
 
    'Admob
    AdView1.Initialize("Ad", "XXX-XXXXXXXXXXXXXXXX")
    Activity.AddView(AdView1, 0dip, 0dip, 320dip, 50dip)' AdView1.LoadAd 'loads an ad
      AdView1.LoadAd
 
End Sub

Sub Activity_Resume
    AdView1.Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    AdView1.Pause
End Sub

'*************Admob subs
Sub mwadi_AdFailedToLoad (ErrorMessage As String)
    Log("failed to load ad: " & ErrorMessage)
End Sub
Sub Ad_ReceiveAd
    Log("received")
End Sub
Sub Ad_AdScreenDismissed
   Log("screen dismissed")
End Sub
Sub mwadi_AdClosed
 
Last edited:

Kjell

Member
Licensed User
Longtime User
Thanks, that helped me one step further.

I still have to comment out this line in the project attributes, or else I get an error:

#AdditionalRes: C:\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms

B4X:
B4A version: 5.50
Parsing code.    (0.00s)
Compiling code.    (0.02s)
Compiling layouts code.    (0.00s)
Generating R file.    Error
c:\android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values-v21\appinvite_styles.xml:5: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.
 
Upvote 0
Top